From: H.G.Muller Date: Tue, 28 Oct 2014 19:45:23 +0000 (+0100) Subject: Work-around for move during ponder X-Git-Tag: v2.0~9 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d7b4912c91352afe825b55def9eaa7ed2117299b;p=uci2wb.git Work-around for move during ponder When engines, in violation of UCI specs, moved during ponder without waiting for 'stop' or 'ponderhit', UCI2WB would pass their move out of turn to the GUI, and hang when the opponent would move, waiting for an engine move that had already come. We now ignore such a premature ending of the ponder search, like no ponder search was made at all. And we give an error message in the engine output. --- diff --git a/UCI2WB.c b/UCI2WB.c index ed3b884..7fd2130 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -148,7 +148,7 @@ void StopPonder(int pondering) { if(!pondering) return; - pause = 1; + pause = 2; fprintf(toE, "stop\n"); fflush(toE); DPRINT("# stop\n"); // note: 'pondering' remains set until engine acknowledges 'stop' with 'bestmove' Sync(PAUSE); // wait for engine to acknowledge 'stop' with 'bestmove'. } @@ -237,6 +237,7 @@ Engine2GUI() if(sscanf(line, "%s", command) != 1) continue; if(!strcmp(command, "bestmove")) { if(pause) { pondering = pause = 0; Sync(WAKEUP); continue; } // bestmove was reply to ponder miss or analysis result; ignore. + else if(pondering) { pondering = 0; printf("%d 0 0 0 UCI violation! Engine moves during ponder\n", lastDepth+1); continue; } // ignore ponder search // move was a move to be played if(p = strstr(line+8, " draw")) *p = 0, printf("offer draw\n"); // UCCI if(strstr(line+9, "resign")) { printf("resign\n"); computer = NONE; }