Minor fix to how deck is initialized

This commit is contained in:
Mattia Giambirtone 2022-06-13 01:18:12 +02:00
parent d69448d8db
commit 2a4725a0e0
1 changed files with 2 additions and 2 deletions

View File

@ -81,7 +81,7 @@ def get_default_deck(n_decks: int = 1) -> deque[UNOCard]:
result = []
for __ in range(n_decks):
# Numbers: 1 to 9 for each color
# Numbers: 1 to 9 for each color (twice for each color)
for color in [UNOCardColor.GREEN, UNOCardColor.RED,
UNOCardColor.YELLOW, UNOCardColor.BLUE]:
for _ in range(2):
@ -199,7 +199,7 @@ async def play(_: Client, message: Message):
name = f"{message.from_user.first_name or ''}{message.from_user.last_name or ''}"
creator = UNOPlayer(message.from_user.id, name, [])
deck = get_default_deck(decks)
game = UNOGame(players=[creator], table=deque([deck.popleft()]), direction=UNODirection.CLOCKWISE)
game = UNOGame(players=[creator], deck=deck, table=deque([deck.popleft()]), direction=UNODirection.CLOCKWISE)
LOBBIES.append(UNOLobby(creator, game))
USERS[creator.id] = (PlayerAction.WAITING_LOBBY, LOBBIES[-1])
await message.reply_text(f"Lobby created (playing with {decks} deck{'s' if decks > 1 else ''}). Tell your friends to send me `/join {message.from_user.id}` to join the game")