void\r
StartSearch(char *ponder)\r
{ // send the 'go' command to engine. Suffix by ponder.\r
- 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
+ int x = (ponder[0] != 0);\r
+ int nr = moveNr + x; // we ponder for one move ahead!\r
+ fprintf(toE, "\ngo btime %d wtime %d", stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime);\r
+ DPRINT( "\n# go btime %d wtime %d", stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime);\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
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
// 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
} else move[moveNr][0] = 0;\r
Move4GUI(line+9);\r
printf("move %s\n", line+9); // send move to GUI\r
- if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == WHITE ? "1-0" : "0-1"); computer = NONE; }\r
- stm = WHITE+BLACK - stm;\r
+ if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == BLACK ? "1-0" : "0-1"); computer = NONE; }\r
}\r
else if(!strcmp(command, "info")) {\r
int d=0, s=0, t=0, n=0;\r