summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CAO_Game.py10
-rw-r--r--CAO_Player.py10
2 files changed, 15 insertions, 5 deletions
diff --git a/CAO_Game.py b/CAO_Game.py
index 3738277..c6072a5 100644
--- a/CAO_Game.py
+++ b/CAO_Game.py
@@ -38,7 +38,11 @@ class CAO_Game():
except IndexError:
return cao_error('no enough white cards for player')
- player = CAO_Player(client, cards)
+ player = CAO_Player(client)
+
+ for card in cards:
+ player.receive_card(card)
+
client.set_player(player)
client.set_game(self)
@@ -122,7 +126,7 @@ class CAO_Game():
# reset the state of the players
for p in self.players:
if p.get_has_played:
- p.cards.append(self.board.pick_white_card())
+ p.receive_card(self.board.pick_white_card())
p.set_has_played(False)
self.board.recycle_black_card()
@@ -136,7 +140,7 @@ class CAO_Game():
cards = []
for card in player.cards:
- cards.append(self.white_desc[card])
+ cards.append((card, self.white_desc[player.cards[card]]))
return cao_success(cards)
diff --git a/CAO_Player.py b/CAO_Player.py
index 9501a46..94ff2cf 100644
--- a/CAO_Player.py
+++ b/CAO_Player.py
@@ -1,6 +1,8 @@
class CAO_Player():
- def __init__(self, client, cards):
- self.cards = cards
+ def __init__(self, client):
+ self.cards = {}
+ self.next_idx = 0
+
self.client = client
self.score = 0
@@ -21,3 +23,7 @@ class CAO_Player():
def inc_score(self):
self.score += 1
+
+ def receive_card(self, card):
+ self.cards[self.next_idx] = card
+ self.next_idx += 1