diff frontends/src/quick_frontend/quick_card_game.py @ 328:809733b8d9be

Tarot game: - draw game managed - we can now play continuously \o/
author Goffi <goffi@goffi.org>
date Mon, 23 May 2011 00:46:51 +0200
parents b1794cbb88e5
children be9f682c53a5
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_card_game.py	Sun May 22 12:59:25 2011 +0200
+++ b/frontends/src/quick_frontend/quick_card_game.py	Mon May 23 00:46:51 2011 +0200
@@ -27,7 +27,7 @@
 class QuickCardGame():
     
     def __init__(self, parent, referee, players, player_nick):
-        self._autoplay = None #XXX: use 0 to activate fake play, None else
+        self._autoplay = 0 #None #XXX: use 0 to activate fake play, None else
         self.parent = parent
         self.referee = referee
         self.players = players
@@ -50,6 +50,15 @@
         self.to_show = []
         self.state = None
 
+    def resetRound(self):
+        """Reset the game's variables to be reatty to start the next round"""
+        del self.selected[:]
+        del self.hand[:]
+        del self.to_show[:]
+        self.state = None
+        for pl in self.played:
+            self.played[pl] = None
+        
     def getPlayerLocation(self, nick):
         """return player location (top,bottom,left or right)"""
         for location in ['top','left','bottom','right']:
@@ -91,10 +100,10 @@
         self.to_show = []
         for suit, value in cards:
             self.to_show.append(self.cards[suit, value])
-            if game_stage == "chien" and data['attaquant'] == self.player_nick:
-                self.state = "wait_for_ecart"
-            else:
-                self.state = "chien"
+        if game_stage == "chien" and data['attaquant'] == self.player_nick:
+            self.state = "wait_for_ecart"
+        else:
+            self.state = "chien"
 
     def myTurn(self):
         """Called when we have to play :)"""