From 1e8b2a6e137452edec15c70394d22bf864a5d54f Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 30 Nov 2016 12:09:00 +0100 Subject: [PATCH] Implement UCI_AnalyseMode option An engine option of the form "??I_AnalyseMode" is now assumed to be the standard check option UCI_... or USI_... (OK, that is a bit flaky). It will not be reported as option feature, and will be automatically set during analysis. --- UCI2WB.c | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/UCI2WB.c b/UCI2WB.c index 73a55c6..7d915e8 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -44,7 +44,7 @@ char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', suffix[81], *variants, varOpt; 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]; +char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20], varList[8000], anaOpt[20]; char 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; @@ -191,6 +191,12 @@ StartPonder() StartSearch(" ponder"); } +void +Analyze(char *val) +{ + if(*anaOpt) EPRINT((f, "# setoption %s%s %s%s\n", nameWord, anaOpt, valueWord, val)); +} + char *Convert(char *pv) { // convert Shogi coordinates to WB char *p, *q, c; @@ -321,6 +327,7 @@ Engine2GUI() if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; } if(!strcasecmp(name, "UCI_Variant")) { if(p = strstr(line+6, " var ")) strcpy(varList, p); varOpt = 1; continue; } if(!strcasecmp(name, "UCI_Opponent")) { namOpt = 1; continue; } + if(!strcasecmp(name+2, "I_AnalyseMode")) { strcpy(anaOpt, name); continue; } if(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) { EPRINT((f, "# setoption name %s value true\n", name)) strcpy(val, "true"); // set non-standard suspected FRC options } @@ -527,8 +534,8 @@ GUI2Engine() suspended = 0; // causes thinking to start in normal way if on move or analyzing } else if(!strcmp(command, "xboard")) ; - else if(!strcmp(command, "analyze"))computer = ANALYZE, collect = 1, sm = 0; - else if(!strcmp(command, "exit")) computer = NONE, StopPonder(1), searching = 0; + else if(!strcmp(command, "analyze"))computer = ANALYZE, collect = 1, sm = 0, Analyze("true"); + else if(!strcmp(command, "exit")) computer = NONE, StopPonder(1), searching = 0, Analyze("false"); else if(!strcmp(command, "force")) computer = NONE, StopPonder(pondering); else if(!strcmp(command, "go")) computer = stm; else if(!strcmp(command, "time")) sscanf(line+4, "%d", &myTime), myTime = (10*myTime)/unit; -- 1.7.0.4