Exemple #1
0
 def withdraw(self, playername, game_name):
     """Withdraw a player from the game."""
     game = self.name_to_game(game_name)
     if game:
         if game.started:
             game.withdraw(playername)
         else:
             try:
                 game.remove_player(playername)
             except AssertionError:
                 pass
             else:
                 if len(game.players) == 0:
                     if game in self.games:
                         self.games.remove(game)
                     action = Action.RemoveGame(game.name)
                     self.notify(action)
                 else:
                     action = Action.Withdraw(playername, game.name)
                     self.notify(action)
Exemple #2
0
 def withdraw(self):
     """Withdraw from the game."""
     action = Action.Withdraw(self.game.name, self.name)
     self.notify(action)