X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=blobdiff_plain;f=UCI2WB.c;h=3db7bbd2fa97608d88cc6b80cc96272c12c42ca2;hp=2db14246a106a8ab19aeff6e5219738857ac006c;hb=a8c8e03626f0cd085656c31efc672689998d5fdb;hpb=734efe5910e2696b2fe52370758d888998377142 diff --git a/UCI2WB.c b/UCI2WB.c index 2db1424..3db7bbd 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -32,7 +32,7 @@ // Set VARIANTS for in WinBoard variant feature. (With -s option this will always be reset to use "shogi".) #define VARIANTS ",normal,xiangqi" #define STDVARS "chess,chess960,crazyhouse,threecheck,giveaway,atomic,seirawan,shogi,xiangqi" -#define EGT ",syzygypath,nalimovpath,gaviotapath," +#define EGT ",gaviotatbpath,syzygypath,nalimovpath," #define DPRINT if(debug) printf #define EPRINT(X) { char f[999]; sprintf X; DPRINT("%s", f); fprintf(toE, "%s", f + 2*(*f == '#')); /* strip optional # prefix */ } @@ -46,9 +46,9 @@ char move[2000][10], iniPos[256], hashOpt[20], pause, pondering, suspended, pond int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug, flob; int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500], frc, byo = -1, namOpt, comp; char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20], varList[8000], anaOpt[20], backLog[10000], checkOptions[8192] = "Ponder"; -char board[100]; // XQ board for UCCI +char pvs[99][999], board[100]; // XQ board for UCCI char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI -int unit = 1, drawOffer; +int unit = 1, drawOffer, scores[99], mpvSP, maxDepth; volatile int logLen, sentLen; FILE *toE, *fromE, *fromF; @@ -157,7 +157,7 @@ StartSearch(char *ponder) if(inc && !*suffix) EPRINT((f, " %s %d %s %d", wInc, inc, bInc, inc)) if(depth > 0) EPRINT((f, " depth %d", depth)) if(*suffix) EPRINT((f, suffix, inc)) - EPRINT((f, "\n")) + EPRINT((f, "\n")); maxDepth = mpvSP = 0; } void @@ -326,9 +326,12 @@ Engine2GUI() if(p = strstr(line+4, " time ")) sscanf(p+6, "%d", &t), t /= 10, statTime = t; if(p = strstr(line+4, " currmove ")) sscanf(p+10,"%s", currMove); if(p = strstr(line+4, " currmovenumber ")) sscanf(p+16,"%d", &currNr); - if(pv = strstr(line+4, " pv ")) // convert PV info to WB thinking output + if(pv = strstr(line+4, " pv ")) { // convert PV info to WB thinking output + if(d > maxDepth) maxDepth = d, mpvSP = 0; else if(d < maxDepth) continue; // ignore depth regressions + for(i=0; i= mpvSP) strncpy(pvs[mpvSP], pv+4, 998), scores[mpvSP++] = s, // emit as thinking output if not printf("%3d %6d %6d %10d %s", lastDepth=d, lastScore=s, t, n, Convert(pv+4)); - else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) + } else if(s == -100000) lastScore = s; // when checkmated score is valid even without PV (which might not come) } } else if(!strcmp(command, "option")) { // USI option: extract data fields @@ -355,7 +358,7 @@ Engine2GUI() } if(!strcasecmp(name, "newgame") && !strcmp(type, "button")) { newGame++; continue; } if(!strcasecmp(name, "usemillisec")) { unit = (!strcmp(val, "false") ? 2 : 1); continue; } - sprintf(buf, ",%s,", name); if(strcasestr(EGT, buf)) { buf[strlen(buf)-5] = 0; strcat(egts, buf); continue; } // collect EGT formats + sprintf(buf, ",%s,", name); if(strcasestr(EGT, buf)) { buf[strlen(buf)-5-2*(buf[3]=='v')] = 0; strcat(egts, buf); continue; } // collect EGT formats // pass on engine-defined option as WB option feature if(!strcmp(type, "filename")) type[4] = 0; else if(sc == 'c' && !strcmp(type, "string")) { // in UCI try to guess which strings are file or directory names @@ -434,7 +437,7 @@ GUI2Engine() // and set engine thinking (note USI swaps colors!) startTime = GetTickCount(); mySide = stm; // remember side we last played for if(computer == ANALYZE) { - EPRINT((f, "# go infinite")) + EPRINT((f, "# go infinite")); maxDepth = mpvSP = 0; if(sm & 1) { // some moves are disabled EPRINT((f, " searchmoves")) for(i=1; i