From: H.G.Muller Date: Mon, 27 Oct 2014 22:35:31 +0000 (+0100) Subject: Compactify timing code by figuring out who is black first X-Git-Tag: v2.0~19 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=9106cb55be2eee65075e4cd9954d371c82ecd8e0;p=uci2wb.git Compactify timing code by figuring out who is black first A new variable 'black' is set when the engine plays black, to know if the XBoard 'time' setting should be transmitted as 'wtim' or 'btim'. --- 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); }