This commit is contained in:
Jonas_Jones 2022-12-23 03:54:54 +01:00
parent dd30027f87
commit 8fc0a3fe95
5 changed files with 55 additions and 2 deletions

View file

@ -248,3 +248,11 @@ class 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()

15
game.py
View file

@ -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')

View file

@ -137,3 +137,12 @@ class BOT:
def __str__(self):
return self.name
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())

View file

@ -84,3 +84,11 @@ class PLAYER:
'''
self.cards = cards
if __name__ == "__main__":
import game
player = PLAYER("Bot", 1, game.create_cards())
print(player.get_cards())
print(player.play_card())
print(player.get_cards())

View file

@ -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()