From: H.G.Muller Date: Sun, 6 Nov 2016 11:15:31 +0000 (+0100) Subject: Implement CECP 'computer' command X-Git-Tag: v2.3~10 X-Git-Url: http://winboard.nl/cgi-bin?p=uci2wb.git;a=commitdiff_plain;h=291c1c2fdf76767c159c8a4ae2a24dbc5916ac51;hp=738b96496d2cf30e7f7f25c49cce148f0443517a Implement CECP 'computer' command Remember if the 'computer' command was received from the GUI, and use this info when setting the UCI_Opponent option to distinguish 'human' and 'computer' as first word, instead of the uniformative 'none'. The implemntation assumes 'computer' would be sent before 'name', which XBoard does (but the CECP specs do not guarantee). --- diff --git a/UCI2WB.c b/UCI2WB.c index 5e1f96b..9b197bb 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -41,7 +41,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; +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 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 @@ -527,7 +527,8 @@ GUI2Engine() else if(!strcmp(command, "cores")&& !!*threadOpt) sscanf(line, "cores %d", &cores), fprintf(toE, "setoption %s%s %s%d\n", nameWord, threadOpt, valueWord, cores); else if(!strcmp(command, "sd")) sscanf(line, "sd %d", &depth); else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0, sTime /= unit; - else if(!strcmp(command, "name")) { if(namOpt) fprintf(toE, "setoption name UCI_Opponent value none none none %s", line+5); } + else if(!strcmp(command, "name")) { if(namOpt) fprintf(toE, "setoption name UCI_Opponent value none none %s %s", comp ? "computer" : "human", line+5); } + else if(!strcmp(command, "computer")) comp = 1; else if(!strcmp(command, "offer")) drawOffer = 1; else if(!strcmp(command, "result")) { if(sc == 's') fprintf(toE, "gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose"); } else if(!strcmp(command, "quit")) fprintf(toE, "quit\n"), fflush(toE), exit(0);