int nr = moveNr + (ponder[0] != 0); // we ponder for one move ahead!\r
fprintf(toE, "\ngo btime %d wtime %d", stm == BLACK ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ sc=='s' ? myTime : hisTime);\r
DPRINT( "\n# go btime %d wtime %d", stm == BLACK ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ sc=='s' ? myTime : hisTime);\r
- if(sTime > 0) fprintf(toE, " movetime %d", sTime),printf(" movetime %d", sTime); else\r
- if(mps) fprintf(toE, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2),printf(" movestogo %d", mps*(nr/(2*mps)+1)-nr/2);\r
- if(inc && !suffix) fprintf(toE, " winc %d binc %d", inc, inc),printf(" winc %d binc %d", inc, inc);\r
- if(depth > 0) fprintf(toE, " depth %d", depth),printf(" depth %d", depth);\r
- if(suffix) fprintf(toE, suffix, inc),printf(suffix, inc);\r
+ if(sTime > 0) { fprintf(toE, " movetime %d", sTime); DPRINT(" movetime %d", sTime); } else\r
+ if(mps) { fprintf(toE, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2); DPRINT(" movestogo %d", mps*(nr/(2*mps)+1)-nr/2); }\r
+ if(inc && !suffix) { fprintf(toE, " winc %d binc %d", inc, inc); DPRINT(" winc %d binc %d", inc, inc); }\r
+ if(depth > 0) { fprintf(toE, " depth %d", depth); DPRINT(" depth %d", depth); }\r
+ if(suffix) { fprintf(toE, suffix, inc); DPRINT(suffix, inc); }\r
fprintf(toE, "%s\n", ponder);\r
- printf("%s\n", ponder);\r
+ DPRINT("%s\n", ponder);\r
}\r
\r
void\r
int j;\r
fprintf(toE, "%s moves", iniPos);\r
DPRINT( "# %s moves", iniPos);\r
- for(j=0; j<moveNr; j++) fprintf(toE, " %s", move[j]),printf(" %s", move[j]);\r
+ for(j=0; j<moveNr; j++) { fprintf(toE, " %s", move[j]); DPRINT(" %s", move[j]); }\r
}\r
\r
char *Convert(char *pv)\r
char line[1024], command[256];\r
\r
while(1) {\r
- int i=0, x; char *p;\r
+ int i=0, x; char *p, dummy;\r
\r
fflush(stdout); fflush(toE);\r
while((line[i] = x = fgetc(fromE)) != EOF && line[i] != '\n') i++;\r
line[++i] = 0;\r
if(x == EOF) exit(0);\r
- DPRINT("# engine said: %s", line); fflush(stdout);\r
+ DPRINT("# engine said: %s", line), fflush(stdout);\r
sscanf(line, "%s", command);\r
if(!strcmp(command, "bestmove")) {\r
if(pause) { pondering = pause = 0; Sync(WAKEUP); continue; } // bestmove was reply to ponder miss or analysis result; ignore.\r
int d=0, s=0, t=0, n=0;\r
char *pv;\r
if(!post) continue;\r
- if(strstr(line, "info string ") == line) printf("%d 0 0 0 %s", lastDepth, line+12); else {\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 cp ")) sscanf(p+10, "%d", &s), statScore = s; else\r
if(p = strstr(line+4, " score mate ")) sscanf(p+12, "%d", &s), s += s>0 ? 100000 : -100000, statScore = s; else\r