summaryrefslogtreecommitdiff
path: root/CAO_Game.py
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-05 02:13:25 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-05 02:14:56 +0100
commit76431d4ff189b8531f7bc89dc80e9fa4b8e79bbd (patch)
tree00c687316e42d644fa58b9e5fcf9ea31eb17906a /CAO_Game.py
parenta6a207603c0e1872f424e349cf38533f728b35c9 (diff)
provide the state of the game to a newcomer
Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Game.py')
-rw-r--r--CAO_Game.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/CAO_Game.py b/CAO_Game.py
index c12442a..aac2c57 100644
--- a/CAO_Game.py
+++ b/CAO_Game.py
@@ -52,7 +52,16 @@ class CAO_Game():
if p is not player:
p.send_notification({'op': 'player_joined_game'})
- return self.try_view_player_cards(player)
+ cards = self.__view_player_cards(player)
+
+ if self.state is self.WAITING_NEW_JUDGE:
+ state = 'waiting_judge'
+ elif self.state is self.WAITING_COLLECTION:
+ state = 'waiting_collection'
+ else:
+ state = 'waiting_designation'
+
+ return cao_success({'cards': cards, 'game_state': state})
def try_become_judge(self, player):
@@ -166,13 +175,16 @@ class CAO_Game():
return cao_success(None)
- def try_view_player_cards(self, player):
+ def __view_player_cards(self, player):
cards = []
for card in player.cards:
cards.append((card, self.white_desc[player.cards[card]]))
- return cao_success(cards)
+ return cards
+
+ def try_view_player_cards(self, player):
+ return cao_success(self.__view_player_cards(player))
def try_view_played_cards(self, player):
if self.state is not self.WAITING_DESIGNATION: