added reuse of subtree for simulations (apply_move), played around with rollout depth

This commit is contained in:
2024-01-29 12:26:19 +01:00
parent a2cb3a5719
commit f1a36964df
7 changed files with 80 additions and 42 deletions

View File

@@ -21,11 +21,12 @@ class EvaluationResult:
game: chess.pgn.Game
def simulate_game(white: Engine, black: Engine, limit: Limit) -> chess.pgn.Game:
board = chess.Board()
def simulate_game(white: Engine, black: Engine, limit: Limit, board: chess.Board) -> chess.pgn.Game:
is_white_playing = True
while not board.is_game_over():
print("simulation board:\n", board)
print()
print("mcts board:\n", white.mcts.board)
play_result = white.play(board, limit) if is_white_playing else black.play(board, limit)
board.push(play_result.move)
is_white_playing = not is_white_playing