mirror of
https://github.com/JonasunderscoreJones/EPR-Gruppenabgabe-07.git
synced 2025-10-23 01:39:18 +02:00
uwu
This commit is contained in:
parent
dd30027f87
commit
8fc0a3fe95
5 changed files with 55 additions and 2 deletions
|
@ -247,4 +247,12 @@ class Matrix:
|
||||||
for i in range(len(matrix)):
|
for i in range(len(matrix)):
|
||||||
for j in range(len(matrix[i])):
|
for j in range(len(matrix[i])):
|
||||||
self.set(self, x + j, y + i, matrix[i][j])
|
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
15
game.py
|
@ -93,3 +93,18 @@ if __name__ == '__main__':
|
||||||
print(card_deck)
|
print(card_deck)
|
||||||
|
|
||||||
print(deal_cards(card_deck, 5, 5))
|
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')
|
||||||
|
|
11
game_bot.py
11
game_bot.py
|
@ -136,4 +136,13 @@ class BOT:
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
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())
|
||||||
|
|
|
@ -83,4 +83,12 @@ class PLAYER:
|
||||||
list of cards
|
list of cards
|
||||||
'''
|
'''
|
||||||
self.cards = cards
|
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())
|
||||||
|
|
|
@ -403,3 +403,16 @@ def stich_win_screen(screen:Matrix, winner, players:list, cards:list,
|
||||||
draw_player_cards(screen, cards, players)
|
draw_player_cards(screen, cards, players)
|
||||||
screen.print()
|
screen.print()
|
||||||
input()
|
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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue