From: <umg...@us...> - 2007-06-14 16:19:13
|
Revision: 419 http://svn.sourceforge.net/pybridge/?rev=419&view=rev Author: umgangee Date: 2007-06-14 09:19:10 -0700 (Thu, 14 Jun 2007) Log Message: ----------- Necessary to weaken start-game check, since client-side Game objects will not have a full set of players. Add "reveal all hands" at end of game. Modified Paths: -------------- trunk/pybridge/pybridge/bridge/game.py Modified: trunk/pybridge/pybridge/bridge/game.py =================================================================== --- trunk/pybridge/pybridge/bridge/game.py 2007-06-14 13:15:37 UTC (rev 418) +++ trunk/pybridge/pybridge/bridge/game.py 2007-06-14 16:19:10 UTC (rev 419) @@ -73,8 +73,8 @@ def start(self, board=None): - if not self.isNextGameReady(): - raise GameError, "Not ready to start game" + if self.inProgress(): + raise GameError, "Game in progress" if board: # Use specified board. self.board = board @@ -242,8 +242,12 @@ self.notify('makeCall', call=call, position=position) - if self.bidding.isPassedOut(): - self.notify('gameOver') # TODO: reveal all hands + # If bidding is passed out, reveal all hands. + if not self.inProgress() and self.board['deal']: + for position in Direction: + hand = self.board['deal'].get(position) + if hand and position not in self.visibleHands: + self.revealHand(hand, position) def signalAlert(self, alert, position): @@ -302,7 +306,13 @@ dummyhand = self.board['deal'].get(self.play.dummy) if dummyhand: # Reveal hand only if known. self.revealHand(dummyhand, self.play.dummy) - # TODO: if game over, reveal all hands + + # If play is complete, reveal all hands. + if not self.inProgress() and self.board['deal']: + for position in Direction: + hand = self.board['deal'].get(position) + if hand and position not in self.visibleHands: + self.revealHand(hand, position) def revealHand(self, hand, position): @@ -412,7 +422,9 @@ def startNextGame(self): - self.__game.start() # Raises GameError if not ready to start next game. + if not self.__game.isNextGameReady(): + raise GameError, "Not ready to start game" + self.__game.start() # Raises GameError if game in progress. # Aliases for remote-callable methods. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |