/* of which you should have received a copy together with this file. */\r
/****************************************************************************/\r
\r
-#define VERSION "3.0"\r
+#define VERSION "4.0"\r
\r
#include <stdio.h>\r
#include <stdlib.h>\r
if(!move[moveNr][0]) return; // no ponder move\r
LoadPos(moveNr+1);\r
searching = 1; lastDepth = 1;\r
+ DPRINT("# ponder on %s\n", move[moveNr]);\r
StartSearch(" ponder");\r
}\r
\r
// first start a new ponder search, if pondering is on and we have a move to ponder on\r
if(p = strstr(line+9, "ponder")) {\r
sscanf(p+7, "%s", move[moveNr]);\r
- if(computer != NONE && ponder) {\r
- DPRINT("# ponder on %s\n", move[moveNr]);\r
- StartPonder(moveNr);\r
- }\r
+ if(computer != NONE && ponder) StartPonder(moveNr);\r
p[-1] = '\n'; *p = 0; // strip off ponder move\r
} else move[moveNr][0] = 0;\r
Move4GUI(line+9);\r
}\r
continue;\r
}\r
- if(collect && (pv = strstr(line+5, "currmove "))) {\r
- if(p = strstr(line+5, "currmovenumber ")) {\r
- n = atoi(p+15);\r
- if(collect == 1 && n != 1) continue; // wait for move 1\r
- if(collect + (n == 1) > 2) { // done collecting\r
- if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth);\r
- collect = 3; continue;\r
- }\r
- collect = 2; on[nr=n] = 1; sscanf(pv+9, "%s", moveMap[n]); continue; // store move\r
- }\r
- }\r
if(!post) continue;\r
if(sscanf(line+5, "string %c", &dummy) == 1) printf("%d 0 0 0 %s", lastDepth, line+12); else {\r
if(p = strstr(line+4, " depth ")) sscanf(p+7, "%d", &d), statDepth = d;\r
if(p = strstr(line+4, " score ")) sscanf(p+7, "%d", &s), statScore = s;\r
if(p = strstr(line+4, " nodes ")) sscanf(p+7, "%d", &n), statNodes = n;\r
if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t;\r
- if(p = strstr(line+4, " currmove ")) sscanf(p+10,"%s", currMove);\r
- if(p = strstr(line+4, " currmovenumber ")) sscanf(p+16,"%d", &currNr);\r
if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output\r
if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions\r
if(p = strstr(line+4, " upperbound ")) strcat(p, "?\n"); else\r
printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4));\r
} else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come)\r
}\r
+ if(collect && (pv = strstr(line+4, " currmove "))) {\r
+ sscanf(pv+10,"%s", currMove);\r
+ if(p = strstr(line+4, " currmovenumber ")) {\r
+ n = currNr = atoi(p+16);\r
+ if(collect == 1 && n != 1) continue; // wait for move 1\r
+ if(collect + (n == 1) > 2) { // done collecting\r
+ if(inex && collect == 2) printf("%d 0 0 0 OK to exclude\n", lastDepth);\r
+ collect = 3; continue;\r
+ }\r
+ collect = 2; on[nr=n] = 1; strcpy(moveMap[n], currMove); continue; // store move\r
+ }\r
+ }\r
}\r
else if(!strcmp(command, "option")) { // USI option: extract data fields\r
char name[80], type[80], buf[1024], val[256], *q;\r
sprintf(buf + strlen(buf), "%s%s%s", min++ ? " /// " : " ", strcmp(type, val) ? "" : "*", val);\r
}\r
strcat(q, "\"\n");\r
+\r
}\r
else buf[0] = 0; // ignore unrecognized option types\r
if(buf[0]) printf("%s", buf);\r
{\r
int i;\r
\r
- if((computer == stm || computer == ANALYZE && !searching && sm != 1) && !suspended) {\r
+ if(suspended || searching) return;\r
+\r
+ if(computer == stm || computer == ANALYZE && sm != 1) {\r
DPRINT("# start search\n");\r
LoadPos(moveNr); fflush(stdout); // load position\r
// and set engine thinking (note USI swaps colors!)\r
EPRINT((f, "\n")) searching = 2; // suppresses spurious commands during analysis starting new searches\r
} else searching = 3, StartSearch(""); // request suspending of input processing while thinking\r
} else if(ponderAlways && computer == NONE) move[moveNr][0] = 0, StartPonder(moveNr-1);\r
+ else if(BLACK+WHITE-stm == computer && ponder && moveNr) StartPonder(moveNr);\r
}\r
\r
void\r
else if(!strcmp(command, "post")) post = 1;\r
else if(!strcmp(command, "nopost"))post = 0;\r
else if(!strcmp(command, ".")) {\r
- printf("stat01: %d %d %d %d 100 %s\n", statTime, statNodes, statDepth, 100-currNr, currMove);\r
+ printf("stat01: %d %d %d %d %d %s\n", statTime, statNodes, statDepth, nr-currNr, nr, currMove);\r
}\r
else if(!strcmp(command, "pause")) {\r
if(computer == stm) myTime -= GetTickCount() - startTime;\r