question about winboard protocol(? during pondering)
Posted:
01 Dec 2004, 09:21
by Uri Blass
Movei had problems to play a match against yace with ponder on with the autoplayer.
The problem is that movei continued to ponder when yace resigned and based on the logfile never got the result command.
Should engine stop to ponder when it gets the "?" during pondering?
Here are the words from the winboard protocol:
"?
Move now. If your engine is thinking, it should move immediately; otherwise, the command should be ignored (treated as a no-op). "
Movei was not the side to move so moving immediately does not make sense.
I chose the second option to ignore the ? and the result is that movei continued to ponder and ignored more commands later like the level command and the new command.
Uri
Re: question about winboard protocol(? during pondering)
Posted:
01 Dec 2004, 09:39
by Richard Pijl
Here are the words from the winboard protocol:
"?
Move now. If your engine is thinking, it should move immediately; otherwise, the command should be ignored (treated as a no-op). "
Movei was not the side to move so moving immediately does not make sense.
I chose the second option to ignore the ? and the result is that movei continued to ponder and ignored more commands later like the level command and the new command.
Seems the problem is in ignoring the following commands.
The Baron writes an error message when it gets a '?' during pondering.
Richard.
Re: question about winboard protocol(? during pondering)
Posted:
01 Dec 2004, 10:06
by Uri Blass
I think that it is not clear based on the winboard protocol what to do.
"If the engine is thinking it should move immediately."
We can agree that during pondering the engine is thinking(otherwise during playing it is also not thinking).
part of moving immediatly is stop to think about the move that you calculate so the engine may also stop to ponder in case of getting the ? command.
Uri
Re: question about winboard protocol(? during pondering)
Posted:
03 Dec 2004, 01:29
by Alessandro Scotti
I think that Movei was correct in ignoring the "?" command while pondering, but it's not clear to me why it ignored the subsequent commands too...
Re: question about winboard protocol(? during pondering)
Posted:
03 Dec 2004, 02:01
by Uri Blass
The reason is clear.
I do not like to do too many things during pondering.
Usually it gets the result command during pondering that only tell it to stop pondering so later it can listen to more commands.
If I ignore the ? command and do not stop to ponder then I am afraid from bugs in responding to the new command.
The problem is that I need both to stop to ponder and to tell the program to start a new game and I usually tell it to start a new game only when the program wait passively for commands.
I am afraid to have bugs if I tell it something that I never told it before in pondering mode and I prefer first to stop to ponder and only later to listen to commands that ask me more than stopping to ponder or listening to the time(after reading the time Movei wait passively for the opponent move).
The problem is that if I read new during pondering I need to do the following steps:
1)remember the new command
2)stopping to ponder
3)asking the program to do the new command.
I can probably add global variable to do it so the program will know that it got new command during pondering but I do not like to do it.
I also need to find where exactly in the code the program is going to go after finishing pondering to know when exactly to add
if (new_during_pondering==1)
{
new_during_pondering=0;
new_command();
}
I simply dislike it.
Uri
Re: question about winboard protocol(? during pondering)
Posted:
03 Dec 2004, 03:14
by Brian Richardson
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