From: H.G.Muller Date: Mon, 27 Oct 2014 23:09:52 +0000 (+0100) Subject: Implement UCCI newgame option X-Git-Tag: v2.0~16 X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=commitdiff_plain;h=9dc81a4e9cd733c1ac04515325534749a39d8959 Implement UCCI newgame option In UCCI 'newgame' is an engine-defined option, which should only be sent when the engine has announced it. --- diff --git a/UCI2WB.c b/UCI2WB.c index 21aad7d..15b35de 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -35,7 +35,7 @@ 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 +char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI int unit = 1; FILE *toE, *fromE, *fromF; @@ -297,11 +297,12 @@ Engine2GUI() if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI if(!strcmp(name, "Threads")) { strcpy(threadOpt, name); continue; } if(!strcmp(name, "Ponder") || !strcmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } - if(!strcmp(name, "Hash") || !strcmp(name, "USI_Hash")) { + if(!strcmp(name, "Hash") || !strcmp(name, "USI_Hash") || !strcmp(name, "hashsize")) { memory = oldMem = atoi(val); hasHash = 1; strcpy(hashOpt, name); continue; } + if(!strcmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } // pass on engine-defined option as WB option feature if(!strcmp(type, "filename")) type[4] = 0; sprintf(buf, "feature option=\"%s -%s", name, type); q = buf + strlen(buf); @@ -386,9 +387,10 @@ GUI2Engine() if(memory != oldMem && hasHash) fprintf(toE, "setoption name %s %s%d\n", hashOpt, valueWord, memory); oldMem = memory; // we can set other options here + if(sc == 'x') { if(newGame) fprintf(toE, "setoption newgame\n"); } else // optional in UCCI + fprintf(toE, "u%cinewgame\n", sc); fflush(toE); pause = 1; // wait for option settings to take effect fprintf(toE, "isready\n"); - fprintf(toE, "u%cinewgame\n", sc); fflush(toE); Sync(PAUSE); // wait for readyok } else if(!strcmp(command, "usermove")) {