Hi Roger,
Roger Brown wrote:In UCI mode, how does Deep Sjeng tell the gui that it is quitting now as the search is complete?
I would expect that his engine terminates the search with the normal "bestmove" command sent to the GUI.
Roger Brown wrote:[...] isn't the spec you are ignoring precisely due to your genius as a programmer?
I mean, you are programming your engine to behave rationally and quit on finding mate but the spec you cited clearly expects the engine to consider the position until the time period is ended regardless of whether there is anything further to consider.
As to "ignoring the spec", Gian-Carlo clearly stated (and this is also my opinion) that the UCI spec is not precise enough in this case. It explains the "movetime" subcommand with "search exactly x mseconds" but does not mention the obvious exceptional case of exiting earlier, while it does so for the "ponder" and "infinite" subcommands.
The usual way to deal with a spec that is found to be imprecise to some degree is to fix it. However, we cannot expect the UCI spec to be changed. This situation immediately gives room for interpretation. In the given case Gian-Carlo has provided his understanding, and I think it is quite reasonable. I can also tell you why:
You can advise a modern chess engine to search "exactly 60000 mseconds" from a mate-in-6 position. Nevertheless it will take only very short time to find the mate, after only very few iterations of search. Now there are these choices, after having found the mate:
a) Continue "searching" until the predefined time is up. Run more iterations, with a "virtual" maximum search depth increasing consistently, but always finding the same shorter mate variation instantly without even going to the full maximum depth. Pretty useless kind of burning your CPU.
b) Stop searching internally but do not report the final result yet, instead fall asleep until the predefined time is up, then wake up and report your mate. Would you expect that?
c) Stop searching internally like b) but instead of falling asleep, play a nice video until the time is up. I guess you would prefer this one
d) Go the rational way by exiting immediately when finding the mate. I'd prefer it this way, regardless of the protocol being used.
For me the most convincing point of Gian-Carlo is that doing so does not break anything.
Sven