From 7bd5b32b970229a4a9cc23ca2e8849e30c6d9823 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 21 Sep 2016 15:05:13 +0200 Subject: [PATCH] Subtract byoyomi from wtime and btime USI engines think byoyomi comes in addition to their time on the clock, so the time passed from the GUI in CECP must be decreased by the byoyomi to let the engine know how close it is to forfeit. --- UCI2WB.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index 62e17e4..ff5ec8c 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -141,13 +141,14 @@ StartSearch(char *ponder) 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! + int t = (flob ? inc + myTime/40 : 1000*byo*(byo>0)); // byoyomi time if(sc == 'x') black = 1; else drawOffer = 0;// in UCCI 'black' refers to us and 'white' to opponent if(!x && drawOffer) ponder = " draw", drawOffer = 0; //pass draw offer only when not pondering - fprintf(toE, "\ngo%s %stime %d %stime %d", ponder, bTime, black ? myTime : hisTime, wTime, !black ? myTime : hisTime); - DPRINT( "\n# go%s %stime %d %stime %d", ponder, bTime, black ? myTime : hisTime, wTime, !black ? myTime : hisTime); + fprintf(toE, "\ngo%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t); + DPRINT( "\n# go%s %stime %d %stime %d", ponder, bTime, (black ? myTime : hisTime) - t, wTime, (!black ? myTime : hisTime) - t); 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(flob || byo >= 0) sprintf(suffix, " byoyomi %d", byo >=0 ? 1000*byo : inc + myTime/40); // for engines running purely on byoyomi + if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", t); // for engines running purely on byoyomi if(inc && !*suffix) { fprintf(toE, " %s %d %s %d", wInc, inc, bInc, inc); DPRINT(" %s %d %s %d", wInc, inc, bInc, inc); } if(depth > 0) { fprintf(toE, " depth %d", depth); DPRINT(" depth %d", depth); } if(*suffix) { fprintf(toE, suffix, inc); DPRINT(suffix, inc); } -- 1.7.0.4