From: H.G. Muller Date: Sun, 16 Dec 2012 08:42:12 +0000 (+0100) Subject: Implement Ponder option X-Git-Tag: v2.0~25 X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=commitdiff_plain;h=6339bbabc92588399ae64225e62db0aa571aa921 Implement Ponder option UCI2WB now makes the possibility to ponder subject to the engine reporting the Ponder option, and sets this option according to the WB ponder state. --- diff --git a/UCI2WB.c b/UCI2WB.c index e0570a2..7256061 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -32,7 +32,8 @@ 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 +int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500]; +char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20]; FILE *toE, *fromE, *fromF; int pid; @@ -237,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, "Ponder") || !strcmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; } if(!strcmp(name, "Hash") || !strcmp(name, "USI_Hash")) { memory = oldMem = atoi(val); hasHash = 1; strcpy(hashOpt, name); @@ -414,8 +416,8 @@ GUI2Engine() else if(!strcmp(command, "otim")) sscanf(line+4, "%d", &hisTime), hisTime *= 10; else if(!strcmp(command, "post")) post = 1; else if(!strcmp(command, "nopost")) post = 0; - else if(!strcmp(command, "easy")) ponder = 0, StopPonder(pondering); - else if(!strcmp(command, "hard")) ponder = 1, StartPonder(); + else if(!strcmp(command, "easy") && !!*canPonder) ponder = 0, StopPonder(pondering), fprintf(toE, "setoption name %s value false\n", canPonder); + 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);