pensquid / yobmef

Weird toy chess engine written *very much from scratch* in Rust.
14 stars 1 forks source link

Time management: fix running out of time #10

Closed UlisseMini closed 3 years ago

UlisseMini commented 3 years ago

Since we don't exit the search immediately in alphabeta, the thinking_time argument will almost always be exceeded. This can be fixed two ways

  1. Factor the time being exceeded into the Engine.thinking_time calculation
  2. Pass quit function through alphabeta and quit immediately. Be careful that you pass quit the right SearchResult though.
UlisseMini commented 3 years ago

It does seem weird though that it runs out of time since once it gets low it should be running a very small depth. Maybe there is a bug I've overlooked.

UlisseMini commented 3 years ago

I found the bug, it was an infinite loop in get_pv() when a transposition occurs. Fixed with a HashSet.

UlisseMini commented 3 years ago

Reopening, time management is not fixed, though I did fix the deadlock. We still use too much time in iterative deepening.

UlisseMini commented 3 years ago

This is going to be the mother of all refactors, I've got to implement threading to do this right, and rust ownership being what it is, well...