From 8fc0a3fe95c5d83941ae63630f6e0effaa29fc08 Mon Sep 17 00:00:00 2001 From: Jonas_Jones <91549607+J-onasJones@users.noreply.github.com> Date: Fri, 23 Dec 2022 03:54:54 +0100 Subject: [PATCH] uwu --- cmd_interface.py | 8 ++++++++ game.py | 15 +++++++++++++++ game_bot.py | 11 ++++++++++- game_player.py | 10 +++++++++- screen_handler.py | 13 +++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) diff --git a/cmd_interface.py b/cmd_interface.py index 957aa52..6a56611 100644 --- a/cmd_interface.py +++ b/cmd_interface.py @@ -247,4 +247,12 @@ class Matrix: for i in range(len(matrix)): for j in range(len(matrix[i])): self.set(self, x + j, y + i, matrix[i][j]) + + +if __name__ == "__main__": + term = Terminal() + term.set_frame(0, 0, term.get_columns(), term.get_lines(), title="Test", + alligncenter=True) + term.set_string_center(1, "Hello World!") + term.print() \ No newline at end of file diff --git a/game.py b/game.py index f75b97e..b1b8173 100644 --- a/game.py +++ b/game.py @@ -93,3 +93,18 @@ if __name__ == '__main__': print(card_deck) print(deal_cards(card_deck, 5, 5)) + +if __name__ == '__main__': + # Testcases + deck = create_cards() + print(deck) + print(deal_cards(create_cards(), deck, 5)) + print(deal_cards(create_cards(), deck, 0)) + try: + print(deal_cards(create_cards(), deck, 100)) + except: + print('Exception') + + print(compare_cards([{'rank': 'Ace', 'suit': 'Spades'}, {'rank': 'Ace', 'suit': 'Spades'}]), 'Spades') + print(compare_cards([{'rank': 'Ace', 'suit': 'Spades'}, {'rank': 'Ace', 'suit': 'Hearts'}]), 'Hearts') + print(compare_cards([{'rank': 'Ace', 'suit': 'Spades'}, {'rank': 'Ace', 'suit': 'Diamond'}]), 'Hearts') diff --git a/game_bot.py b/game_bot.py index b5fd003..7ef0f87 100644 --- a/game_bot.py +++ b/game_bot.py @@ -136,4 +136,13 @@ class BOT: def __str__(self): return self.name - \ No newline at end of file + +if __name__ == "__main__": + + import game + + # Create a bot + bot = BOT("Bot", 1, game.create_cards()) + print(bot.get_cards()) + print(bot.play_card()) + print(bot.get_cards()) diff --git a/game_player.py b/game_player.py index b3a2b0c..29d98a7 100644 --- a/game_player.py +++ b/game_player.py @@ -83,4 +83,12 @@ class PLAYER: list of cards ''' self.cards = cards - \ No newline at end of file + +if __name__ == "__main__": + + import game + + player = PLAYER("Bot", 1, game.create_cards()) + print(player.get_cards()) + print(player.play_card()) + print(player.get_cards()) diff --git a/screen_handler.py b/screen_handler.py index 8ff7dfb..737b502 100644 --- a/screen_handler.py +++ b/screen_handler.py @@ -403,3 +403,16 @@ def stich_win_screen(screen:Matrix, winner, players:list, cards:list, draw_player_cards(screen, cards, players) screen.print() input() + + +if __name__ == "__main__": + + # Create a new screen + screen = Matrix(Terminal.get_columns(), Terminal.get_lines()) + screen.set_frame(0, 0, Terminal.get_columns() - 1, + Terminal.get_lines() - 1, rounded=True, title="Welcome \ +to the game!") + screen.set_string_center(2, "Welcome to the game!") + screen.set_string_center(3, "Press ENTER to start the game...") + screen.print() + input()