rbaltrusch / chess_ng

Full chess engine including chess AI
MIT License
3 stars 2 forks source link

Dynamic time-based depth #10

Open rbaltrusch opened 2 years ago

rbaltrusch commented 2 years ago

As the game progresses and there are less pieces on the board, the same depth used for the evaluation function results in smaller and smaller execution times, due to a smaller total amount of moves possible. This means that evaluation a move at depth 4 may take ~25s in the early game, but ~0.1s during the late game.

This behaviour could be streamlined by searching at a higher depth depending on: 1) The amount of time needed to calculate the previous move and adjusting depending on that 2) The amount of pieces on the board / the amount of possible moves

This should result in slightly slower moves in the late game, but significantly sharper gameplay. The current AI strategy of positional play (maximizing possible own moves, and minimizing the possible moves for the other side) works well in the late game, but at depth=4 often ends up in drawn out games with the AI noodling around quite a bit when it could just force a win e.g. by promoting a passed pawn.