X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=178cdcb97e7c71b8cdd38df66a18b8a1cfcb4966;hp=9d568f73b961f697add7f51b31470ea0245b88e2;hb=8e699739bef4730a34efb65939800a3a3b6f13b0;hpb=9ab6e3faf717202a5ce807808975a4c29711a8e5 diff --git a/UCI2WB.c b/UCI2WB.c index 9d568f7..178cdcb 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -48,7 +48,7 @@ int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, in char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20], varList[8000], anaOpt[20], backLog[10000], checkOptions[8192] = "Ponder"; char pvs[99][999], board[100]; // XQ board for UCCI char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI -int unit = 1, drawOffer, scores[99], mpvSP, maxDepth; +int unit = 1, drawOffer, scores[99], mpvSP, maxDepth, ponderAlways; volatile int logLen, sentLen; FILE *toE, *fromE, *fromF; @@ -185,7 +185,7 @@ LoadPos(int moveNr) } void -StartPonder() +StartPonder(int moveNr) { if(!move[moveNr][0]) return; // no ponder move LoadPos(moveNr+1); @@ -206,7 +206,7 @@ Release() if(len <= 0) return 0; StopPonder(pondering | searching); pondering = searching = 0; // force new search if settings change during analysis (multi-PV!) fwrite(backLog + sentLen, 1, len, toE); sentLen += len; DPRINT("# release %d\n", len); - if(ponder && computer == 1 - stm) StartPonder(); // (re)start ponder search + if(ponder && computer == 1 - stm) StartPonder(moveNr); // (re)start ponder search return analyse; // return 1 if analysis search should be restarted } @@ -287,7 +287,7 @@ Engine2GUI() sscanf(p+7, "%s", move[moveNr]); if(computer != NONE && ponder) { DPRINT("# ponder on %s\n", move[moveNr]); - StartPonder(); + StartPonder(moveNr); } p[-1] = '\n'; *p = 0; // strip off ponder move } else move[moveNr][0] = 0; @@ -455,7 +455,7 @@ GUI2Engine() } EPRINT((f, "\n")) searching = 1; // suppresses spurious commands during analysis starting new searches } else pause = think = 2, StartSearch(""); // request suspending of input processing while thinking - } + } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1); nomove: for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking fflush(toE); fflush(stdout); @@ -485,6 +485,7 @@ GUI2Engine() char *p; if(logLen == sentLen) logLen = 0, sentLen = 0; // engine is up to date; reset buffer if(sscanf(line+7, "UCI2WB debug output=%d", &debug) == 1) ; else + if(sscanf(line+7, "ponder always=%d", &ponderAlways) == 1) ; else if(sscanf(line+7, "Floating Byoyomi=%d", &flob) == 1) ; else if(sscanf(line+7, "Byoyomi=%d", &byo) == 1) ; else if(p = strchr(line, '=')) { @@ -519,7 +520,7 @@ GUI2Engine() continue; } if(!strcmp(command, "resume")) { - if(suspended == 2) StartPonder(); // restart interrupted ponder search + if(suspended == 2) StartPonder(moveNr); // restart interrupted ponder search suspended = think = 0; continue; // causes thinking to start in normal way if on move or analyzing } if(think) { // command arrived during thinking; order abort for 'instant commands' @@ -550,6 +551,7 @@ GUI2Engine() if(!varList[0]) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); printf("feature setboard=1 usermove=1 debug=1 ping=1 name=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0\n"); printf("feature option=\"UCI2WB debug output -check %d\"\n", debug); + printf("feature option=\"ponder always -check %d\"\n", ponderAlways); if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\"\nfeature option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo); EPRINT((f, sc == 'x' ? "# ucci\n" : "# u%ci\n", sc)) fflush(toE); // prompt UCI engine for options Sync(PAUSE); // wait for uciok