From: H.G.Muller <hgm@hgm-xboard.(none)>
Date: Wed, 30 Nov 2016 11:09:00 +0000 (+0100)
Subject: Implement UCI_AnalyseMode option
X-Git-Tag: v4.0~49
X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=1e8b2a6e137452edec15c70394d22bf864a5d54f;p=uci2wb.git

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.
---

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;