}\r
\r
void\r
-StopPonder(int pondering)\r
+StopSearch(int discard)\r
{\r
- if(!pondering) return;\r
+ if(!searching) return;\r
+ if(discard) searching = 0; // this causes bestmove to be ignored\r
EPRINT((f, "# stop\n")) fflush(toE); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove'\r
}\r
\r
else if(!strcmp(command, "pause")) {\r
if(computer == stm) myTime -= GetTickCount() - startTime;\r
suspended = 1 + (searching == 1); // remember if we were pondering, and stop search ignoring bestmove\r
- if(searching) searching = 0, StopPonder(1);\r
+ StopSearch(1);\r
}\r
else { //convert easy & hard to "option" after treating their effect on the adapter\r
if(!strcmp(command, "easy")) {\r
EPRINT((f, "# ponderhit%s\n", draw)) fflush(toE); fflush(stdout);\r
continue;\r
}\r
- searching = 0; StopPonder(1);\r
+ StopSearch(1);\r
}\r
strcpy(move[moveNr++], command); // possibly overwrites ponder move\r
*qEnd++ = '\n'; Sync(WAKEUP); // make sure engine thread considers starting a search\r
{\r
if(searching == 3) { // command arrived during thinking; order abort for 'instant commands'\r
if(!strcmp(command, "?") || !strcmp(command, "quit") ||\r
- !strcmp(command, "force") || !strcmp(command, "result")) StopPonder(1);\r
- } else if(searching) searching = 0, StopPonder(1); // always abort pondering or analysis\r
+ !strcmp(command, "force") || !strcmp(command, "result")) StopSearch(0);\r
+ } else StopSearch(1); // always abort pondering or analysis\r
\r
// queue command for execution by engine thread\r
if(qStart == qEnd) qStart = qEnd = queue;\r