summaryrefslogtreecommitdiff
path: root/CAO_Board.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_Board.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_Board.py')
-rw-r--r--CAO_Board.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/CAO_Board.py b/CAO_Board.py
new file mode 100644
index 0000000..925b1ee
--- /dev/null
+++ b/CAO_Board.py
@@ -0,0 +1,52 @@
+import random
+
+class CAO_Board():
+ def __init__(self, white_cards, black_cards):
+ self.white_pick = white_cards
+ self.black_pick = black_cards
+
+ self.white_recycled = []
+ self.black_recycled = []
+
+ self.current_black_card = None
+
+ # tupple of cards / player currently being played
+ self.played_cards = []
+
+ random.shuffle(self.white_pick)
+ random.shuffle(self.black_pick)
+
+ def reveal_black_card(self):
+ if not self.black_pick:
+ self.black_pick = self.black_recycle
+
+ random.shuffle(self.black_pick)
+
+ self.black_recycled = []
+
+ card = self.black_pick.pop()
+
+ self.current_black_card = card
+
+ def recycle_black_card(self):
+ self.black_recycled.append(self.current_black_card)
+
+ def pick_white_card(self):
+ if not self.white_pick:
+ self.white_pick = self.white_recycled
+
+ random.shuffle(self.white_pick)
+
+ self.white_recycled = []
+
+ card = self.white_pick.pop()
+
+ return card
+
+ def play_card(self, player, card):
+ self.played_cards.append((card, player))
+
+ def recycle_played_cards(self):
+ self.white_recycled += [i[0] for i in self.played_cards]
+
+ self.played_cards = []