From: H.G.Muller Date: Sun, 9 Dec 2018 07:20:28 +0000 (+0100) Subject: Let LaunchSearch() also start ponder search X-Git-Tag: v4.0 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=801e160fe3c49c8b8756729acc9066adc0e9b388;p=uci2wb.git Let LaunchSearch() also start ponder search Ponder searches are normally started when HandleEngineOutput() receives the result of thinking, but this does not cover the case where a user switches on pondering while the engine is idle. LaunchMove() now takes care of this by starting a ponder search if one is needed but none is running. This is possible because the ponder move is always appended to the move list, even when ponder is off, and thus is available. --- diff --git a/UCI2WB.c b/UCI2WB.c index a546859..7cdf340 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -188,6 +188,7 @@ StartPonder(int moveNr) if(!move[moveNr][0]) return; // no ponder move LoadPos(moveNr+1); searching = 1; lastDepth = 1; + DPRINT("# ponder on %s\n", move[moveNr]); StartSearch(" ponder"); } @@ -266,10 +267,7 @@ HandleEngineOutput() // first start a new ponder search, if pondering is on and we have a move to ponder on if(p = strstr(line+9, "ponder")) { sscanf(p+7, "%s", move[moveNr]); - if(computer != NONE && ponder) { - DPRINT("# ponder on %s\n", move[moveNr]); - StartPonder(moveNr); - } + if(computer != NONE && ponder) StartPonder(moveNr); p[-1] = '\n'; *p = 0; // strip off ponder move } else move[moveNr][0] = 0; Move4GUI(line+9); @@ -371,6 +369,7 @@ HandleEngineOutput() sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val); } strcat(q, "\"\n"); + } else buf[0] = 0; // ignore unrecognized option types if(buf[0]) printf("%s", buf); @@ -424,7 +423,9 @@ LaunchSearch() { int i; - if((computer == stm || computer == ANALYZE && !searching && sm != 1) && !suspended) { + if(suspended || searching) return; + + if(computer == stm || computer == ANALYZE && sm != 1) { DPRINT("# start search\n"); LoadPos(moveNr); fflush(stdout); // load position // and set engine thinking (note USI swaps colors!) @@ -438,6 +439,7 @@ LaunchSearch() EPRINT((f, "\n")) searching = 2; // suppresses spurious commands during analysis starting new searches } else searching = 3, StartSearch(""); // request suspending of input processing while thinking } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1); + else if(BLACK+WHITE-stm == computer && ponder && moveNr) StartPonder(moveNr); } void