Пример #1
0
 def test_game_with_one_move(self):
     result = MCTS(GameWithOneMove).get_simulation_result(100)
     self.assertEqual(result.move, 'win')
     self.assertEqual(result.root.children[0].wins_by_player[1], 100)
     self.assertEqual(result.max_depth, 1)
Пример #2
0
def main():
    state = EuchreGame.initial_state(['ad', '0d', 'kd', '0s', '9s'], trump='d')
    result = (MCTS(EuchreGame, state)
              .get_simulation_result(1000, get_leaf_nodes=True))
    flamegraph(result)
Пример #3
0
 def test_only_determined_moves_are_followed(self):
     result = (MCTS(
         GameWithManyMovesOnlyOneDetermined).get_simulation_result(100))
     self.assertEqual(result.root.children[0].move, 1)
     self.assertEqual(result.root.children[0].visits, 100)