From: H.G.Muller Date: Sat, 8 Dec 2018 09:21:03 +0000 (+0100) Subject: Launch searches at end of GUI loop X-Git-Tag: v4.0~17 X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=commitdiff_plain;h=9e92f9f1e4e601912bd40334c9f89677b9b65f23 Launch searches at end of GUI loop The loop for interpreting GUI commands is restructured by launching searches at the bottom of it rather than at the top. As it was an infinite loop anyway this only eliminates the first call to LaunchSearch(), which is OK as the engine would never have to search before any commands were received. As this change brought the 'nomove' label to the top of the loop, the 'goto's to it could be replaced by 'continue's, and the label deleted. That for engines that cannot ponder the 'easy' and 'hard' commands now skip LaunchSearch() is OK, as LaunchSearch() would not do anything in that case. --- diff --git a/UCI2WB.c b/UCI2WB.c index d44de74..b9df43c 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -469,8 +469,6 @@ GUI2Engine() while(1) { int i, difficult; - LaunchSearch(); // start a search if we need one - nomove: for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking fflush(toE); fflush(stdout); if(!ReadLine(stdin, line)) printf("# EOF\n"), sprintf(line, "quit -1\n"); @@ -525,7 +523,7 @@ GUI2Engine() searching = 0; pause = 2; moveNr++; startTime = GetTickCount(); // clock starts running now EPRINT((f, "# ponderhit%s\n", draw)) fflush(toE); fflush(stdout); searching = 3; // request blocking input during thinking - goto nomove; + continue; } StopPonder(1); searching = 0; } @@ -544,8 +542,10 @@ GUI2Engine() } if(qStart == qEnd) qStart = qEnd = queue; p = line; while(qEnd < queue+10000 && (*qEnd++ = *p++) != '\n') {} - if(DoCommand()) goto nomove; + if(DoCommand()) continue; } + + LaunchSearch(); // start a search if we need one } }