X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=33546037baccf0772288def903ca25598b0996f6;hp=95fe4116b5fba7e1e77ef128ba173c111b026b0d;hb=9106cb55be2eee65075e4cd9954d371c82ecd8e0;hpb=524e729b9b66af01911b8abfa6bb5b66e0ab706a diff --git a/UCI2WB.c b/UCI2WB.c index 95fe411..3354603 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -35,7 +35,6 @@ int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, o int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500]; char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20]; char board[100]; // XQ board for UCCI -char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc"; // keywords that differ in UCCI int unit = 1; FILE *toE, *fromE, *fromF; @@ -129,10 +128,11 @@ Play(int nr) void StartSearch(char *ponder) { // send the 'go' command to engine. Suffix by ponder. - int x = (ponder[0] != 0); - int nr = moveNr + x; // we ponder for one move ahead! - fprintf(toE, "\ngo%s btime %d wtime %d", ponder, stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime); - DPRINT( "\n# go%s btime %d wtime %d", ponder, stm == BLACK ^ x ^ sc=='s' ? myTime : hisTime, stm == WHITE ^ x ^ sc=='s' ? myTime : hisTime); + int x = (ponder[0] != 0); // during ponder stm is the opponent + int black = (stm == BLACK ^ x ^ sc == 's'); // set if our color is what the engine calls black + int nr = moveNr + x; // we ponder for one move ahead! + fprintf(toE, "\ngo%s btime %d wtime %d", ponder, black ? myTime : hisTime, !black ? myTime : hisTime); + DPRINT( "\n# go%s btime %d wtime %d", ponder, black ? myTime : hisTime, !black ? 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); }