X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=UCI2WB.c;h=b92e975409dda78eae87359b0e40a070878c352b;hb=2ce85eeb80b638776c971733316052337ea363b0;hp=725606198a78013786e23cacd21a3c9c8b4e7171;hpb=6339bbabc92588399ae64225e62db0aa571aa921;p=uci2wb.git diff --git a/UCI2WB.c b/UCI2WB.c index 7256061..b92e975 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -33,7 +33,7 @@ char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', *suffix, *variants; int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug; int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500]; -char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20]; +char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20]; FILE *toE, *fromE, *fromF; int pid; @@ -238,6 +238,7 @@ Engine2GUI() if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n'; if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n'; if(p = strstr(line+6, " name ")) sscanf(p+1, "name %[^\n]*", name); + 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")) { memory = oldMem = atoi(val); hasHash = 1; @@ -368,7 +369,7 @@ GUI2Engine() Sync(PAUSE); // wait for uciok } else if(!strcmp(command, "setboard")) { - if(strstr(line+9, " b ")) stm = BLACK; + stm = (strstr(line+9, " b ") ? BLACK : WHITE); if(p = strchr(line+9, '[')) { char c; *p++ = 0; q = strchr(p, ']'); *q = 0; r = q + 4; if(sc == 's') q[2] = 'w' + 'b' - q[2], strcpy(r=q+3, " 1\n"); // Shogi: reverse color @@ -420,7 +421,7 @@ GUI2Engine() else if(!strcmp(command, "hard") && !!*canPonder) ponder = 1, fprintf(toE, "setoption name %s value true\n", canPonder), StartPonder(); else if(!strcmp(command, "ping")) pause = 1, fprintf(toE, "isready\n"), fflush(toE), Sync(PAUSE), printf("pong %s", line+5); else if(!strcmp(command, "memory")) sscanf(line, "memory %d", &memory); - else if(!strcmp(command, "cores")) sscanf(line, "cores %d", &cores); + else if(!strcmp(command, "cores")&& !!*threadOpt) sscanf(line, "cores %d", &cores), fprintf(toE, "setoption name %s value %d\n", threadOpt, cores); else if(!strcmp(command, "sd")) sscanf(line, "sd %d", &depth); else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0; else if(!strcmp(command, "quit")) fprintf(toE, "quit\n"), fflush(toE), exit(0);