DPRINT("# engine said: %s", line), fflush(stdout);\r
if(sscanf(line, "%s", command) != 1) continue;\r
if(!strcmp(command, "bestmove")) {\r
- if(pause) { pondering = pause = 0; Sync(WAKEUP); continue; } // bestmove was reply to ponder miss or analysis result; ignore.\r
+ if(pause == 1) { pondering = pause = 0; Sync(WAKEUP); continue; } // bestmove was reply to ponder miss or analysis result; ignore.\r
else if(pondering) { pondering = 0; printf("%d 0 0 0 UCI violation! Engine moves during ponder\n", lastDepth+1); continue; } // ignore ponder search\r
// move was a move to be played\r
if(p = strstr(line+8, " draw")) *p = 0, printf("offer draw\n"); // UCCI\r
} else move[moveNr][0] = 0;\r
Move4GUI(line+9);\r
printf("move %s\n", line+9); // send move to GUI\r
+ if(pause) { pause = 0; Sync(WAKEUP); } // release commands that came in during think\r
if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == BLACK ? "1-0" : "0-1"); computer = NONE; }\r
}\r
else if(!strcmp(command, "info")) {\r
}\r
fprintf(toE, "\n"); DPRINT("\n");\r
// code for searchmoves goes here\r
- } else StartSearch("");\r
+ } else { pause = 2; StartSearch(""); fflush(stdout); fflush(toE); Sync(PAUSE); } // block input during thinking\r
}\r
nomove:\r
fflush(toE); fflush(stdout);\r
else if(!strcmp(command, "nopost")) post = 0;\r
else if(!strcmp(command, "easy") && !!*canPonder) ponder = 0, StopPonder(pondering), fprintf(toE, "setoption %s%s %sfalse\n", nameWord, canPonder, valueWord);\r
else if(!strcmp(command, "hard") && !!*canPonder) ponder = 1, fprintf(toE, "setoption %s%s %strue\n", nameWord, canPonder, valueWord), StartPonder();\r
- else if(!strcmp(command, "ping")) { static int done; if(!done) pause = 1, fprintf(toE, "isready\n"), fflush(toE), printf("# send isready\n"), fflush(stdout), Sync(PAUSE); done = 1; printf("pong %s", line+5); }\r
+ else if(!strcmp(command, "ping")) { /* static int done; if(!done) pause = 1, fprintf(toE, "isready\n"), fflush(toE), printf("# send isready\n"), fflush(stdout), Sync(PAUSE); done = 1;*/ printf("po%s", line+2); }\r
else if(!strcmp(command, "memory")) sscanf(line, "memory %d", &memory);\r
else if(!strcmp(command, "cores")&& !!*threadOpt) sscanf(line, "cores %d", &cores), fprintf(toE, "setoption %s%s %s%d\n", nameWord, threadOpt, valueWord, cores);\r
else if(!strcmp(command, "sd")) sscanf(line, "sd %d", &depth);\r