diff options
author | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-05-15 02:35:56 +0200 |
---|---|---|
committer | Olivier Gayot <olivier.gayot@sigexec.com> | 2020-05-15 03:13:01 +0200 |
commit | 0c9ee93b7381e9a198ff1efa6703d4cb68a0b58d (patch) | |
tree | 7946784ba32442ca9b35255c838d3a124423537d | |
parent | e560cb629851cd27191756a62e5aca43150d3bdf (diff) |
Don't pass the cards to the constructor of board
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
-rw-r--r-- | swiftstory/Board.py | 8 | ||||
-rw-r--r-- | swiftstory/Game.py | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/swiftstory/Board.py b/swiftstory/Board.py index 5176e55..f14df41 100644 --- a/swiftstory/Board.py +++ b/swiftstory/Board.py @@ -5,9 +5,9 @@ class Board: ''' This class automatically handles the reshuffling of different deck/heap of cards ''' - def __init__(self, white_cards, black_cards): - self.white_pick = white_cards - self.black_pick = black_cards + def __init__(self): + self.white_pick = list() + self.black_pick = list() self.white_recycled = [] self.black_recycled = [] @@ -17,8 +17,6 @@ class Board: # tupple of cards / player currently being played self.played_cards = [] - random.shuffle(self.white_pick) - random.shuffle(self.black_pick) def reveal_next_black_card(self): if self.current_black_card is not None: diff --git a/swiftstory/Game.py b/swiftstory/Game.py index 9dd19c4..7cd7d15 100644 --- a/swiftstory/Game.py +++ b/swiftstory/Game.py @@ -1,4 +1,5 @@ import json +import random from swiftstory.Player import Player from swiftstory.Board import Board @@ -23,7 +24,12 @@ class Game: self.judge = None - self.board = Board(white_pick, black_pick) + self.board = Board() + self.board.white_pick = white_pick + self.board.black_pick = black_pick + + random.shuffle(self.board.white_pick) + random.shuffle(self.board.black_pick) async def try_join(self, client): if len(self.players) >= 10: |