X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=71dfd4b5e920dfe73ead029b853fbb18e740d01e;hp=acb34d9bc12f64f605d2e7c07b5b782e99f2d820;hb=f72070254816c26ab9e52862e6191b2a59029e4d;hpb=31a0e8b25fb5a579176c4d460dd417253fe8dd35 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