sscanf(line, "bestmove %s", move[moveNr++]);\r
myTime -= (GetTickCount() - startTime)*1.02 - inc; // update own clock, so we can give correct wtime, btime with ponder\r
if(mps && ((moveNr+1)/2) % mps == 0) myTime += tc; if(sTime) myTime = sTime; // new session or move starts\r
- stm = WHITE+BLACK - stm;\r
+ stm = WHITE+BLACK - stm; searching = 0;\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
printf("move %s\n", line+9); // send move to GUI\r
if(move[moveNr][0]) printf("Hint: %s\n", move[moveNr]);\r
if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == BLACK ? "1-0" : "0-1"); computer = NONE; }\r
- return;\r
+ fflush(stdout); return;\r
}\r
else if(!strcmp(command, "info")) {\r
int d=0, s=0, t=(GetTickCount() - startTime)/10, n=1;\r
else if(!strncmp(q-1, " chess ", 7)) strcpy(p, "normal"), p += 6, q += 5; // 'chess' is called 'normal' in CECP\r
else *p++ = *q++; // copy other variant names unmodified\r
if(frc) sprintf(p, ",normal,fischerandom"), printf("feature oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling\r
- if(*varList) printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options\r
+ if(!*varList) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); // without clue guess liberally\r
+ printf("feature variants=\"%s\"\n", varList+1); // from UCI_Variant combo and/or UCI_Chess960 check options\r
if(*egts) printf("feature egt=\"%s\"\n", egts+1);\r
printf("feature smp=1 memory=%d done=1\n", hasHash);\r
if(unit == 2) { unit = 1; EPRINT((f, "# setoption usemillisec true\n")) }\r
- return; // done with options\r
+ fflush(stdout); return; // done with options\r
}\r
}\r
}\r
fflush(toE); fflush(stdout);\r
if(!ReadLine(stdin, line)) printf("# EOF\n"), sprintf(line, "quit -1\n");\r
sscanf(line, "%s", command);\r
+ DPRINT("# %s searching=%d\n", command, searching);\r
if(!strcmp(command, "usermove")) { difficult--; break; } // for efficiency during game play, moves, time & otim are tried first\r
else if(!strcmp(command, "time")) sscanf(line+4, "%d", &myTime), myTime = (10*myTime)/unit;\r
else if(!strcmp(command, "otim")) sscanf(line+4, "%d", &hisTime), hisTime = (10*hisTime)/unit;\r
else if(!strcmp(command, "hard")) {\r
if(*canPonder) ponder = 1, sprintf(command, "option"), sprintf(line, "option %s=1\n", canPonder); else continue;\r
}\r
- else if(!strcmp(command, "option")) {\r
+ if(!strcmp(command, "option")) {\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
\r
p=line; while(qStart < qEnd && (*p++ = *qStart++) != '\n') {} *p = 0;\r
if(line[0] == '\n') return;\r
- sscanf(line, "%s", command);\r
+ sscanf(line, "%s", command); DPRINT("# command %s\n", command), fflush(stdout);\r
\r
if(!strcmp(command, "new")) {\r
computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0;\r
tc = (60*tc + sec)*1000; inc *= 1000; sTime = 0; tc /= unit; inc /= unit;\r
}\r
else if(!strcmp(command, "protover")) {\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
computer = NONE;\r
}\r
else if(!strcmp(command, "quit")) { EPRINT((f, "# quit\n")) fflush(toE), exit(atoi(line+4)); }\r
+\r
+ fflush(stdout);\r
}\r
\r
void *\r