def choose_survivor_message(self, message): """Someome chose which hotel will survive a merge.""" player_name = message['player'] game = self.game_for_player(player_name) if not game: return try: player = gametools.player_named(game, player_name) survivor = gametools.hotel_named(game, message['hotel']) stock_market_shares = gametools.choose_survivor(game, player, survivor) except gametools.GamePlayNotAllowedError, e: self.send_error(player_name, 'Cannot choose survivor', e) return
def test_choose_merge_survivor_when_no_choice(self): self.quantum["tiles"].append("5G") self.merge_quantum_and_fusion() with self.assertRaises(gametools.GamePlayNotAllowedError): gametools.choose_survivor(self.game, self.player, self.fusion)
def test_choose_inappropriate_merge_survivor(self): self.merge_quantum_and_fusion() with self.assertRaises(gametools.GamePlayNotAllowedError): gametools.choose_survivor(self.game, self.player, self.sackson)
def merge_quantum_and_fusion(self, survivor=None): gametools.play_tile(self.game, self.player, self.tile) if survivor: gametools.choose_survivor(self.game, self.player, survivor)