by Brian Richardson » 03 Dec 2004, 03:14
Many engines use a set of flag for each command to indicate if it is valid during searching or pondering, and if the search should be interrupted, etc.
Fully implementing this can be quite tricky, since many commands apply to the root position, and not the current one being searched when checking input periodically during pondering (or searching).
Tinker only handles a much smaller subset of commands during searching or pondering (in the same routine) that have worked reasonably well.
First is just the "." command to reply with stat01 information
After a "?" Tinker stops pondering. Then when the search ends, Tinker knows if it was doing a "real" search, or just pondering, from a global variable.
Tinker also stops after force, result and exit, but a global flag is set to know what to do next (by the way, did the Winboard/Xboard log not show the "result" command, or was in your engine's own log?) Winboard is usually very good about sending result.
Tinker always totally exits after end or quit.
Any other input when puzzling (a quick search to guess an opponent's move to then ponder against) stops, since it could be a move and there would be no point in pondering then anyway.
The time and otim commands just update the respective time variables and the ponder search continues, although a move wil be coming soon.
The draw command triggers the draw accept/reject routine, and only stops
if the draw is accepted. Sometimes ICS players just start typing draw draw draw to get an engine to do something it otherwise would not.
Finally, the command is parsed to see if it is a move. If so, and it is the expected move, the search just continues anyway.
For all other input cases Tinker stops when pondering or puzzling, and ignores the input when searching and not pondering.
There are a couple of other special cases like when in book, but the above works pretty well, although Tinker does not immediately start to ponder in all cases that it could. The more complete options are implemented in Crafty, for example.
Brian