lucasart wrote:Is there a good reason why the engine can't print bestmove upon completion of the ID loop (eg. depth=127 completed) ?
I mean a good reason beyond the "it's written in the UCI protocol".
This seems to me like a design flaw of UCI, forcing engine programmers to add hacks and convoluted code for no reason. Am I missing something ?
Code: Select all
* infinite
search until the "stop" command. Do not exit the search without being told so in this mode!
* stop
stop calculating as soon as possible,
don't forget the "bestmove" and possibly the "ponder" token when finishing the search
Code: Select all
info string "I am done, this is just mate in 1, my bestmove is ...."
Code: Select all
bestmove ....
There is a story telling behind this. The user is the boss, not the engine. If you sent info string "I am done ..." the boss would be glad that he is informed and the boss now would stop the infinite search.
Code: Select all
// tell the engine to search infinite from the start position after 1.e4 e5
position startpos moves e2e4 e7e5
go infinite
// the engine starts sending infos about the search to the GUI
// (only some examples are given)
info depth 1 seldepth 0
info score cp 13 depth 1 nodes 13 time 15 pv f1b5
info depth 2 seldepth 2
info nps 15937
info score cp 14 depth 2 nodes 255 time 15 pv f1c4 f8c5
info depth 2 seldepth 7 nodes 255
info depth 3 seldepth 7
info nps 26437
info score cp 20 depth 3 nodes 423 time 15 pv f1c4 g8f6 b1c3
info nps 41562
....
// here the user has seen enough and asks to stop the searching
stop
// the engine has finished searching and is sending the bestmove command
// which is needed for every "go" command sent to tell the GUI
// that the engine is ready again
bestmove g1f3 ponder d8f6