From: H.G. Muller Date: Thu, 19 Apr 2012 19:18:28 +0000 (+0200) Subject: Implement WB exclude feature X-Git-Tag: v2.0~36 X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=f72070254816c26ab9e52862e6191b2a59029e4d;p=uci2wb.git Implement WB exclude feature UCI2WB collects moves sent by the engne in analysis mode from the currmove, currmovenumber info commands. After the full set for the current position has been completed, UCI2Wb becomes sensitive for WB include and exclude commands, to switch the moves in the list on or off. If not all moves are on, the 'go infinite' will be accompanied by 'searchmoves'. If all moves are off, the current search is allowed to continue. --- diff --git a/UCI2WB.c b/UCI2WB.c index acb34d9..71dfd4b 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -32,7 +32,7 @@ char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, pondering, 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; char currMove[20]; // for analyze mode +int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, on[500]; char currMove[20], moveMap[500][10]; // for analyze mode FILE *toE, *fromE; int pid; @@ -187,6 +187,14 @@ Engine2GUI() int d=0, s=0, t=0, n=0; char *pv; if(sscanf(line+5, "string times @ %c", &dummy) == 1) { printf("# %s", line+12); continue; } + if(collect && (pv = strstr(line+5, "currmove "))) { + if(p = strstr(line+5, "currmovenumber ")) { + n = atoi(p+15); + if(collect == 1 && n != 1) continue; // wait for move 1 + if(collect + (n == 1) > 2) { collect = 3; continue; } // done collecting + collect = 2; on[nr=n] = 1; sscanf(pv+9, "%s", moveMap[n]); continue; // store move + } + } if(!post) continue; if(sscanf(line+5, "string %c", &dummy) == 1) printf("%d 0 0 0 %s", lastDepth, line+12); else { if(p = strstr(line+4, " depth ")) sscanf(p+7, "%d", &d), statDepth = d; @@ -279,8 +287,15 @@ GUI2Engine() LoadPos(moveNr); // load position // and set engine thinking (note USI swaps colors!) startTime = GetTickCount(); - if(computer == ANALYZE) fprintf(toE, "\ngo infinite\n"), printf("\ngo infinite\n"); - else StartSearch(""); + if(computer == ANALYZE) { + fprintf(toE, "\ngo infinite"); DPRINT("\n# go infinite"); + if(sm & 1) { // some moves are disabled + fprintf(toE, " searchmoves"); DPRINT(" searchmoves"); + for(i=1; i i ? moveNr - i : 0; + moveNr = moveNr > i ? moveNr - i : 0; collect = (computer == ANALYZE); sm = 0; } else if(!strcmp(command, ".")) { printf("stat01: %d %d %d %d 100 %s\n", statTime, statNodes, statDepth, 100-currNr, currMove); goto nomove; } + else if(!strcmp(command+2, "clude") && collect > 2) { + int all = !strcmp(line+8, "all"), in = command[1] == 'n'; + line[strlen(line)-1] = sm = 0; // strip LF and clear sm flag + for(i=1; i