Hey, time control is something I am still working on, the current solution is a bit jank just divide time remaining by moves to go. Default moves to go is set to 30. During testing so for we have always been giving it a 1 sec inc, but better time control is one of the things next on the list for sure.
I basically do the same thing and it works fine for me.
If your engine loses on time it always does so in move 40. When moves to go is only 1. To prevent that I subtract a 10ms safety-margin from the budget I compute to be safe. (And of course I abort searches as soon as they go on beyond the time budget!)
Here's a PGN where Weasle still spends 1s (at 0.5s increment) per turn even though both engines agree that there's a mate coming.
That is a good suggestion thank you, safety margin would defiantly help. And I check every 2048 nodes if the search is stopped, I figured that was sufficient. How often do you check if the search is stopped? Also I add 1 7th of the inc, here is how I currently do it
The time budget calculation is in lines 90-130 and in line 142 you can see how I pass a little lambda function to the SearchDeeper() method. It's called everytime before I generate the legal moves of a node to search deeper. If it's false I just don't generate any more child-nodes and the search quickly unwinds.
1
u/TreyM2k Feb 16 '21
Hey, time control is something I am still working on, the current solution is a bit jank just divide time remaining by moves to go. Default moves to go is set to 30. During testing so for we have always been giving it a 1 sec inc, but better time control is one of the things next on the list for sure.