def test_grows_hotel(self):
     game = gametools.new_game()
     gametools.add_player_named(game, "champ")
     gametools.start_game(game)
     blank_board(game)
     hydra = gametools.hotel_named(game, "hydra")
     hydra["tiles"] = ["6A", "6B", "7B"]
     for tile in ["5A"]:
         self.assertTrue(gametools.grows_hotel(game, tile), tile)
     for tile in ["1C", "5C", "8E"]:
         self.assertFalse(gametools.grows_hotel(game, tile), tile)
 def setUp(self):
     self.game = gametools.new_game()
     gametools.add_player_named(self.game, "testlady")
     gametools.add_player_named(self.game, "testgirl")
     gametools.start_game(self.game)
     self.player, self.other_player = self.game["players"]
     self.player["rack"][0] = "1B"
     blank_board(self.game)
     self.game["tilebag"] = ["9F"]
     self.america = gametools.hotel_named(self.game, "america")
     self.america["tiles"] = ["1A", "2A"]
     self.hydra = gametools.hotel_named(self.game, "hydra")
     self.hydra["tiles"] = ["1C", "1D", "1E"]
 def setUp(self):
     self.game = gametools.new_game()
     gametools.add_player_named(self.game, "testwomanican")
     gametools.add_player_named(self.game, "testmanican")
     gametools.add_player_named(self.game, "testvetica")
     self.starting_tiles = gametools.start_game(self.game)
     self.player = gametools.active_player(self.game)
     for hotel in self.game["hotels"]:
         setattr(self, hotel["name"], hotel)
Exemple #4
0
 def play_game_message(self, message):
     """Someone wants to start the game. If it's not the host of the game, 
     let's ignore them.
     """
     player_name = message['player']
     game = self.game_for_player(player_name)
     if game and gametools.host(game)['name'] == player_name:
         try:
             start_tiles = gametools.start_game(game)
         except gametools.GamePlayNotAllowedError, e:
             self.send_error(player_name, 'Cannot start game play', e)
             return
         self.send_to_frontends('play_game', game=game, player=player_name,
                                start_tiles=start_tiles)
         self.send_games_list_to_frontends()
 def test_remove_player_from_finished_game(self):
     gametools.add_player_named(self.game, "testwomanican")
     gametools.start_game(self.game)
     self.game["ended"] = True
     gametools.remove_player_named(self.game, "testwomanican")
     self.assertFalse(self.game["players"])
 def test_remove_player_from_started_game(self):
     gametools.add_player_named(self.game, "testwomanican")
     gametools.start_game(self.game)
     with self.assertRaises(gametools.GameAlreadyStartedError):
         gametools.remove_player_named(self.game, "testwomanican")
 def test_add_player_to_started_game(self):
     gametools.add_player_named(self.game, "chumpwoman")
     gametools.start_game(self.game)
     with self.assertRaises(gametools.GameAlreadyStartedError):
         gametools.add_player_named(self.game, "chumpman")