char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20], varList[8000], anaOpt[20], backLog[10000], checkOptions[8192] = "Ponder";\r
char pvs[99][999], board[100]; // XQ board for UCCI\r
char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI\r
-int unit = 1, drawOffer, scores[99], mpvSP, maxDepth;\r
+int unit = 1, drawOffer, scores[99], mpvSP, maxDepth, ponderAlways;\r
volatile int logLen, sentLen;\r
\r
FILE *toE, *fromE, *fromF;\r
}\r
\r
void\r
-StartPonder()\r
+StartPonder(int moveNr)\r
{\r
if(!move[moveNr][0]) return; // no ponder move\r
LoadPos(moveNr+1);\r
if(len <= 0) return 0;\r
StopPonder(pondering | searching); pondering = searching = 0; // force new search if settings change during analysis (multi-PV!)\r
fwrite(backLog + sentLen, 1, len, toE); sentLen += len; DPRINT("# release %d\n", len);\r
- if(ponder && computer == 1 - stm) StartPonder(); // (re)start ponder search\r
+ if(ponder && computer == 1 - stm) StartPonder(moveNr); // (re)start ponder search\r
return analyse; // return 1 if analysis search should be restarted\r
}\r
\r
sscanf(p+7, "%s", move[moveNr]);\r
if(computer != NONE && ponder) {\r
DPRINT("# ponder on %s\n", move[moveNr]);\r
- StartPonder();\r
+ StartPonder(moveNr);\r
}\r
p[-1] = '\n'; *p = 0; // strip off ponder move\r
} else move[moveNr][0] = 0;\r
}\r
EPRINT((f, "\n")) searching = 1; // suppresses spurious commands during analysis starting new searches\r
} else pause = think = 2, StartSearch(""); // request suspending of input processing while thinking\r
- }\r
+ } else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1);\r
nomove:\r
for(difficult=0; !difficult; ) { // read and handle commands that can (or must) be handled during thinking\r
fflush(toE); fflush(stdout);\r
char *p;\r
if(logLen == sentLen) logLen = 0, sentLen = 0; // engine is up to date; reset buffer\r
if(sscanf(line+7, "UCI2WB debug output=%d", &debug) == 1) ; else\r
+ if(sscanf(line+7, "ponder always=%d", &ponderAlways) == 1) ; else\r
if(sscanf(line+7, "Floating Byoyomi=%d", &flob) == 1) ; else\r
if(sscanf(line+7, "Byoyomi=%d", &byo) == 1) ; else\r
if(p = strchr(line, '=')) {\r
continue;\r
}\r
if(!strcmp(command, "resume")) {\r
- if(suspended == 2) StartPonder(); // restart interrupted ponder search\r
+ if(suspended == 2) StartPonder(moveNr); // restart interrupted ponder search\r
suspended = think = 0; continue; // causes thinking to start in normal way if on move or analyzing\r
}\r
if(think) { // command arrived during thinking; order abort for 'instant commands'\r
if(!varList[0]) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS);\r
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");\r
printf("feature option=\"UCI2WB debug output -check %d\"\n", debug);\r
+ printf("feature option=\"ponder always -check %d\"\n", ponderAlways);\r
if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\"\nfeature option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo);\r
EPRINT((f, sc == 'x' ? "# ucci\n" : "# u%ci\n", sc)) fflush(toE); // prompt UCI engine for options\r
Sync(PAUSE); // wait for uciok\r