From ed305204c9eca12859c8772eef1d64e436e7d518 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Fri, 23 Dec 2016 16:17:58 +0100 Subject: [PATCH] Fix -var option with UCI_Chess960 The variant specified in the -var option would be overruled by the "normal,fischerandom" emitted later under the influence of a UCI_Chess960 option. This is now solved by always sending the variants feature on 'uciok'. The varList is now initialized to the -var string, and overwritten by the protocol defaults before sending 'uci' only when it is still empty. A UCI_Variants option then gets the chance to overwrite this, while a UCI_Chess960 option will append "normal,fischeradom" to the list. --- README.txt | 8 ++++++++ UCI2WB.c | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.txt b/README.txt index 09d94ae..e9f2399 100644 --- a/README.txt +++ b/README.txt @@ -50,6 +50,14 @@ H.G.Muller Change log: +22/12/2016 3.0 +Implement UCI_AnalyseMode option +Allow ?, quit, force and result commands to terminate thinking +Stop search during setoption commands, or buffer those until engine is done thinking +Explicitly report when engine dies, through GUI popup (tellusererror) +Make sure reporting of mated-in-0 score causes resign, even without PV +Fix eclipsing of -var option with engines that have UCI_Chess960 option + 8/11/2016 2.3 Implement handling of 'UCI_Variant' option for variant announcement and selection Pass 'info string variant' line as 'setup' command to allow engine-defined variants diff --git a/UCI2WB.c b/UCI2WB.c index 8e61b41..5e70e5b 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -30,7 +30,7 @@ #include // Set VARIANTS for in WinBoard variant feature. (With -s option this will always be reset to use "shogi".) -#define VARIANTS "normal,xiangqi" +#define VARIANTS ",normal,xiangqi" #define STDVARS "chess,chess960,crazyhouse,threecheck,giveaway,atomic,seirawan,shogi,xiangqi" #define DPRINT if(debug) printf @@ -41,7 +41,7 @@ #define NONE 2 #define ANALYZE 3 -char move[2000][10], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', suffix[81], *variants, varOpt, searching, *binary; +char move[2000][10], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', suffix[81], varOpt, searching, *binary; 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"; @@ -526,8 +526,8 @@ GUI2Engine() tc = (60*tc + sec)*1000; inc *= 1000; sTime = 0; tc /= unit; inc /= unit; } else if(!strcmp(command, "protover")) { - if(!variants) variants = sc=='s' ? "shogi,5x5+5_shogi" : VARIANTS; - printf("feature variants=\"%s\" setboard=1 usermove=1 debug=1 ping=1 name=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0\n", variants); + if(!varList[0]) strcpy(varList, sc=='s' ? ",shogi,5x5+5_shogi" : VARIANTS); + printf("feature setboard=1 usermove=1 debug=1 ping=1 name=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0\n"); printf("feature option=\"UCI2WB debug output -check %d\"\n", debug); if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\"\nfeature option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo); EPRINT((f, sc == 'x' ? "# ucci\n" : "u%ci\n", sc)) fflush(toE); // prompt UCI engine for options @@ -681,7 +681,7 @@ main(int argc, char **argv) if(argc == 2 && !strcmp(argv[1], "-v")) { printf("UCI2WB " VERSION " by H.G.Muller\n"); exit(0); } if(argc > 1 && !strcmp(argv[1], "debug")) { debug = 1; argc--; argv++; } - if(argc > 1 && !strcmp(argv[1], "-var")) { variants = argv[2]; argc-=2; argv+=2; } + if(argc > 1 && !strcmp(argv[1], "-var")) { strcpy(varList+1, argv[2]); *varList = ','; argc-=2; argv+=2; } if(argc > 1 && argv[1][0] == '-') { sc = argv[1][1]; argc--; argv++; } if(argc < 2) { printf("usage is: U%cI2WB [debug] [-s] []\n", sc-32); exit(-1); } if(argc > 2) dir = argv[2]; -- 1.7.0.4