summaryrefslogtreecommitdiff
path: root/CAO_Client.py
diff options
context:
space:
mode:
authorOlivier Gayot <duskcoder@gmail.com>2015-06-04 00:13:55 +0100
committerOlivier Gayot <duskcoder@gmail.com>2015-06-04 00:14:21 +0100
commit1ee77bcb1df495f52aa7633a3d857db19720bbea (patch)
tree55ccc4420617404605f2a9c5bcdb9d3e6397f6a0 /CAO_Client.py
parent22eb778c4f05429dc593c69a60018860024ec56f (diff)
the version version which seems to work correctly
the main file of the project is useless tho for now on Signed-off-by: Olivier Gayot <duskcoder@gmail.com>
Diffstat (limited to 'CAO_Client.py')
-rw-r--r--CAO_Client.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/CAO_Client.py b/CAO_Client.py
new file mode 100644
index 0000000..daf6f7e
--- /dev/null
+++ b/CAO_Client.py
@@ -0,0 +1,48 @@
+from CAO_Game import CAO_Game
+
+class CAO_Client():
+ def __init__(self, game_manager):
+ self.game = None
+ self.game_manager = game_manager
+
+ self.player = None
+
+ def join_game(self, game_name):
+ if self.game is not None:
+ return ('ERR', 'You are already in a game')
+
+ self.game = self.game_manager.join_game(game_name)
+ return self.game.try_join(self)
+
+ def set_player(self, player):
+ self.player = player
+
+ def play_white_card(self, card_id):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_play_card(self.player, card_id)
+
+ def pick_black_card(self):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_become_judge(self.player)
+
+ def collect_cards(self):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_collect_cards(self.player)
+
+ def designate_card(self, card_id):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_designate_card(self.player, card_id)
+
+ def view_player_cards(self):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_view_player_cards(self.player)
+
+ def view_played_cards(self):
+ if self.game is None:
+ return ('ERR', 'You have to join a game first')
+ return self.game.try_view_played_cards(self.player)