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)
def test_where_is_tile(self): game = gametools.new_game() gametools.set_up_hotels(game) game["lonely_tiles"] = ["4C"] quantum = gametools.hotel_named(game, "quantum") quantum["tiles"] = ["8D", "9D"] self.assertEqual(gametools.where_is_tile(game, "1A"), None) self.assertEqual(gametools.where_is_tile(game, "4C"), "lonely") self.assertEqual(gametools.where_is_tile(game, "4D"), None) self.assertEqual(gametools.where_is_tile(game, "8D"), "quantum")
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 start_game_message(self, message): """Someone's starting a new game.""" player = message['player'] game = self.game_for_player(player) if game: error = 'Already in game' detail = ('Please leave your current game before ' 'starting a new one.') self.send_error(player, error, detail) else: game = gametools.new_game(self.next_game_number()) gametools.add_player_named(game, player) self.games_list.append(game) self.send_to_frontends('started_game', player=player, game=game) self.send_games_list_to_frontends() self.log.debug('Game %d started by %s.', game['number'], player)
def setUp(self): self.game = gametools.new_game() gametools.set_up_hotels(self.game)
def setUp(self): self.game = gametools.new_game()