def test_proceed_game(self): game = Game() state, player_id = game.init_game() while not game.is_over(): action = np.random.choice(list(state['actions'])) state, next_player_id = game.step(action) player = game.players[player_id] self.assertEqual(get_downstream_player_id( player, game.players), next_player_id) player_id = next_player_id if not game.is_over(): self.assertIsNotNone(state['actions']) for player_id in range(3): state = game.get_state(player_id) self.assertIsNone(state['actions'])
def test_proceed_game(self): game = Game() state, player_id = game.init_game() while not game.is_over(): action = np.random.choice(list(state['actions'])) state, next_player_id = game.step(action) player = game.players[player_id] self.assertEqual((player.player_id + 1) % len(game.players), next_player_id) player_id = next_player_id for player_id in range(3): state = game.get_state(player_id) self.assertEqual(state['actions'], [])