Here is what the spec says:hgm wrote:I think you make that up entirely yourself. The protocol specs don't say that at all.Don wrote:... - and refusing to move is not an option. At least not with UCI.
What they do explicitly say is that the engine can send 0000 as a move, to be understood as a null move. It does NOT say there are any restrictions to its use (like only in the pv info). In fact it does not even specify that moves sent by the engine have to be legal moves anywhere.
If an engine sends "bestmove 0000", with a score info of 0 cp (or -0 mate) , it is totally conforming to the UCI specs. If a GUI cannot handle that, this GUI is not UCI compliant...
* bestmove <move1> [ ponder <move2> ]
the engine has stopped searching and found the move <move> best in this position.
the engine can send the move it likes to ponder on. The engine must not start pondering automatically.
this command must always be sent if the engine stops searching, also in pondering mode if there is a
"stop" command, so for every "go" command a "bestmove" command is needed!
Directly before that the engine should send a final "info" command with the final search information,
the the GUI has the complete statistics about the last search.
"null" is not a move and it's not in the rules of chess - so this is really quite wrong. The protocol does define 0000 to be a null move sent from the engine - but it is obviously only valid when there is NO legal move to sends - "null move" means "no move", it's not a special kind of move and it's not a pass. With your very wide interpretation the engine should be able to say, "I don't have a move" any time it wants and the GUI should just be able to gracefully handle it. The only possible interpretation of it is that there is legal moves. Otherwise it is just a forfeit. I'm not making this up, try doing this in the next tournament you are playing in, tell the TD you don't wish to play a move (perhaps in a zugzwang position) and see what happens.
I personally think 0000 is another glitch in the protocol, it cannot be used to offer a draw or resign as it has no meaning in the context of chess and if a GUI cannot handle that it's NOT a bug. No GUI should every ask for a search when you are in checkmate or stalemate or the game is over due to repetition.
The other little nastiness in the protocol is that by the rules of chess there is 3-fold repetition and 50 move draw and the possibility to resign or offer a draw. With 3-fold and repetition some player on move must claim it. I implemented 50 move rule in Komodo and saw some games where Komodo threw away the game - giving away pieces to lose when 50 moves had passed due to a buggy GUI. I could make Komodo play as if the draw was farther away but that really seems broken to me. So there SHOULD be a way for a engine to claim the draw. Sending 0000 is not a way to claim a draw because it doesn't explicitly mean anything. It could mean that you resign for example. The only possible meaning it can have by the rules of chess is "there is no legal move to play" and beyond the rules of chess it could only mean "I refuse to play."
If a GUI cannot handle 0000 you say it's not UCI compliant - but I say it's a bug in the UCI spec, not the GUI because what is a GUI supposed to do with meaningless information? Do you mean if it crashes it is not compliant? What behavior would you consider UCI compliant? Here are the broken choices:
1. Treat is as a resignation.
2. Treat it as a draw offer (how is the draw offer accepted or denied?)
3. The GUI exits cleanly (without crashing?)
4. The game is recorded as unfinished? (I'll make Komodo do this every time it is losing)
5. Treat is as a chess variant where any player can pass at will? (That is not chess.)
There is NO spec which says how the GUI is to handle this case and in fact there IS NO sensible way to handle it - so it's a UCI protocol bug or at least a bug in the specification document.
If a chess program is asked to search a position with no moves, I consider that a GUI bug - but there is room for debate on this one. At least sending back 0000 in this (and only this) case is sensible because by definition there is "no move" or "null move." But no serious GUI should ask to search a position that has no legal moves. If a GUI does this it's almost a sure sign it has no legal move generator of it's own - it doesn't even know the rules of the game.