Пример #1
0
 def test_tiles_included_two_adjacencies_away(self):
     blank_board(self.game)
     self.game["lonely_tiles"] = ["1A", "2A"]
     tile = self.player["rack"][0] = "1B"
     gametools.play_tile(self.game, self.player, tile)
     gametools.create_hotel(self.game, self.player, self.zeta)
     self.assertTrue("2A" in self.zeta["tiles"])
Пример #2
0
 def test_turn_rotates_after_creating_hotel(self):
     self.game["lonely_tiles"] = ["1A"]
     tile = self.player["rack"][0] = "1B"
     gametools.play_tile(self.game, self.player, tile)
     gametools.create_hotel(self.game, self.player, self.zeta)
     gametools.purchase(self.game, self.player, {})
     self.assertEqual(gametools.active_player(self.game), self.game["players"][1])
Пример #3
0
 def test_create_hotel_already_on_board(self):
     self.force_active_player_to_create_hotel()
     gametools.create_hotel(self.game, self.player, self.hydra)
     gametools.purchase(self.game, self.player, {})
     self.force_active_player_to_create_hotel()
     with self.assertRaises(gametools.GamePlayNotAllowedError):
         gametools.create_hotel(self.game, self.player, self.hydra)
Пример #4
0
 def test_offer_purchase_after_hotel_creation(self):
     self.game["lonely_tiles"] = ["7C"]
     tile = self.player["rack"][0] = "8C"
     gametools.play_tile(self.game, self.player, tile)
     gametools.create_hotel(self.game, self.player, self.quantum)
     first_action = self.game["action_queue"][0]
     self.assertEqual(first_action["action"], "purchase")
     self.assertEqual(first_action["player"], self.player["name"])
Пример #5
0
 def create_hotel_message(self, message):
     """Someone created a new hotel."""
     player_name = message['player']
     game = self.game_for_player(player_name)
     if not game:
         return
     try:
         player = gametools.player_named(game, player_name)
         hotel = gametools.hotel_named(game, message['hotel'])
         gametools.create_hotel(game, player, hotel)
     except gametools.GamePlayNotAllowedError, e:
         self.send_error(player_name, 'Cannot create hotel', e)
         return
Пример #6
0
 def test_no_founders_share_when_none_available(self):
     self.force_active_player_to_create_hotel()
     other_player = self.game["players"][1]
     other_player["shares"]["america"] = 25
     gametools.create_hotel(self.game, self.player, self.america)
     self.assertEqual(self.player["shares"]["america"], 0)
Пример #7
0
 def test_founders_share(self):
     self.force_active_player_to_create_hotel()
     gametools.create_hotel(self.game, self.player, self.sackson)
     self.assertEqual(self.player["shares"]["sackson"], 1)
Пример #8
0
 def test_tiles_no_longer_lonely(self):
     self.force_active_player_to_create_hotel()
     gametools.create_hotel(self.game, self.player, self.quantum)
     for tile in self.quantum["tiles"]:
         self.assertTrue(tile not in self.game["lonely_tiles"])
Пример #9
0
 def test_create_hotel_without_playing_tile(self):
     with self.assertRaises(gametools.GamePlayNotAllowedError):
         gametools.create_hotel(self.game, self.player, self.zeta)
Пример #10
0
 def test_wrong_player_create_hotel(self):
     self.force_active_player_to_create_hotel()
     other_player = self.game["players"][1]
     with self.assertRaises(gametools.GamePlayNotAllowedError):
         gametools.create_hotel(self.game, other_player, self.fusion)
Пример #11
0
 def test_create_hotel(self):
     self.force_active_player_to_create_hotel()
     gametools.create_hotel(self.game, self.player, self.sackson)
     self.assertTrue(self.sackson["tiles"])