From 4ab8d7efe96ed40e3ae2abf2ef5e55379888cfde Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 7 Sep 2016 20:44:25 +0200 Subject: [PATCH] Add option Byoyomi In USI (-s) mode, UCI2WB now announces an option Byoyomi, which can be used to define a hard byoyomi when the the option Floating Byoyomi is off. Setting it to N is equivalent to a third argument " byoyomi N". With N < 0 the option is switched off. --- UCI2WB.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index 0b1ba71..781f8f5 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -41,7 +41,7 @@ char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', suffix[81], *variants; int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug, flob; -int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500], frc; +int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500], frc, byo = -1; 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", newGame; // keywords that differ in UCCI @@ -147,7 +147,7 @@ StartSearch(char *ponder) DPRINT( "\n# go%s %stime %d %stime %d", ponder, bTime, black ? myTime : hisTime, wTime, !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(flob) sprintf(suffix, " byoyomi %d", inc + myTime/40); // for engines running purely on byoyomi + if(flob || byo >= 0) sprintf(suffix, " byoyomi %d", byo >=0 ? 1000*byo : inc + myTime/40); // 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); } @@ -442,6 +442,7 @@ GUI2Engine() char name[80], *p; if(sscanf(line+7, "UCI2WB debug output=%d", &debug) == 1) ; else if(sscanf(line+7, "Floating Byoyomi=%d", &flob) == 1) ; else + if(sscanf(line+7, "Byoyomi=%d", &byo) == 1) ; else if(p = strchr(line, '=')) { *p++ = 0; if(strstr(checkOptions, line+7)) sprintf(p, "%s\n", atoi(p) ? "true" : "false"); @@ -452,7 +453,7 @@ GUI2Engine() if(!variants) variants = sc=='s' ? "shogi,5x5+5_shogi" : VARIANTS; printf("feature variants=\"%s\" setboard=1 usermove=1 debug=1 ping=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0\n", variants); printf("feature option=\"UCI2WB debug output -check %d\"\n", debug); - if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\"\n", flob); + if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\" option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo); fprintf(toE, sc == 'x' ? "ucci\n" : "u%ci\n", sc); fflush(toE); // prompt UCI engine for options Sync(PAUSE); // wait for uciok } -- 1.7.0.4