X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=UCI2WB.c;h=8b8b4603bc2f1b232a17a02672b6433d3d565bbf;hb=7f8c3e5bd0c3d70daf5b1f4c0b623d38f3301ff6;hp=21aad7d29edbe4ddeaf53ad8af30a51d8232f6ea;hpb=792199f6616669de79a1b09644af1cea831be128;p=uci2wb.git diff --git a/UCI2WB.c b/UCI2WB.c index 21aad7d..8b8b460 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,13 @@ 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; } + if(!strcmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); 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); @@ -329,6 +331,7 @@ Engine2GUI() else if(!strcmp(command, "readyok")) { pause = 0; Sync(WAKEUP); } // resume processing of GUI commands else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) { printf("feature smp=1 memory=%d done=1\n", hasHash); + if(unit == 2) unit = 1, fprintf(toE, "setoption usemillisec true\n"); Sync(WAKEUP); // done with options } } @@ -386,9 +389,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")) {