X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=029b34b133e9abee2e1f3f6fe160d18469edaeb6;hp=256150c9cb906fed65ebada84b6c50230cdf6e42;hb=f9dc502ea66938564e9e6eabcc2aff4199f5dd83;hpb=99de6ab7fd6d624fbf821de5c2e42c1bbba6d914 diff --git a/UCI2WB.c b/UCI2WB.c index 256150c..029b34b 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -79,9 +79,10 @@ Sync (int action) void StartSearch(char *ponder) { // send the 'go' command to engine. Suffix by ponder. - int nr = moveNr + (ponder[0] != 0); // we ponder for one move ahead! - fprintf(toE, "\ngo btime %d wtime %d", stm == BLACK ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ sc=='s' ? myTime : hisTime); - DPRINT( "\n# go btime %d wtime %d", stm == BLACK ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ sc=='s' ? myTime : hisTime); + int x = (ponder[0] != 0); + int nr = moveNr + x; // we ponder for one move ahead! + fprintf(toE, "\ngo btime %d wtime %d", stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime); + DPRINT( "\n# go btime %d wtime %d", stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime); if(sTime > 0) { fprintf(toE, " movetime %d", sTime); DPRINT(" movetime %d", sTime); } else if(mps) { fprintf(toE, " movestogo %d", mps*(nr/(2*mps)+1)-nr/2); DPRINT(" movestogo %d", mps*(nr/(2*mps)+1)-nr/2); } if(inc && !suffix) { fprintf(toE, " winc %d binc %d", inc, inc); DPRINT(" winc %d binc %d", inc, inc); } @@ -173,6 +174,7 @@ Engine2GUI() sscanf(line, "bestmove %s", move[moveNr++]); myTime -= (GetTickCount() - startTime)*1.02 + inc; // update own clock, so we can give correct wtime, btime with ponder if(mps && ((moveNr+1)/2) % mps == 0) myTime += tc; if(sTime) myTime = sTime; // new session or move starts + stm = WHITE+BLACK - stm; // first start a new ponder search, if pondering is on and we have a move to ponder on if(p = strstr(line+9, "ponder")) { sscanf(p+7, "%s", move[moveNr]); @@ -184,8 +186,7 @@ Engine2GUI() } else move[moveNr][0] = 0; Move4GUI(line+9); printf("move %s\n", line+9); // send move to GUI - if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == WHITE ? "1-0" : "0-1"); computer = NONE; } - stm = WHITE+BLACK - stm; + if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == BLACK ? "1-0" : "0-1"); computer = NONE; } } else if(!strcmp(command, "info")) { int d=0, s=0, t=0, n=0;