/* of which you should have received a copy together with this file. */\r
/****************************************************************************/\r
\r
-#define VERSION "2.0"\r
+#define VERSION "2.1"\r
\r
#include <stdio.h>\r
#include <stdlib.h>\r
// move was a move to be played\r
if(p = strstr(line+8, " draw")) *p = 0, printf("offer draw\n"); // UCCI\r
if(strstr(line+9, "resign")) { printf("resign\n"); computer = NONE; }\r
+ if(strstr(line+9, "win")) { printf("%s {claim}\n", stm== WHITE ? "1-0" :"0-1"); computer = NONE; } // USI\r
if(strstr(line+9, "(none)") || strstr(line+9, "null") ||\r
strstr(line+9, "0000")) { printf("%s\n", lastScore < -99999 ? "resign" : "1/2-1/2 {stalemate}"); computer = NONE; }\r
sscanf(line, "bestmove %s", move[moveNr++]);\r
void\r
GUI2Engine()\r
{\r
- char line[256], command[256], *p, *q, *r;\r
+ char line[256], command[256], *p, *q, *r, mySide;\r
\r
while(1) {\r
int i, x;\r
DPRINT("# start search\n");\r
LoadPos(moveNr); fflush(stdout); // load position\r
// and set engine thinking (note USI swaps colors!)\r
- startTime = GetTickCount();\r
+ startTime = GetTickCount(); mySide = stm; // remember side we last played for\r
if(computer == ANALYZE) {\r
fprintf(toE, "\ngo infinite"); DPRINT("\n# go infinite");\r
if(sm & 1) { // some moves are disabled\r
if(!variants) variants = sc=='s' ? "shogi,5x5+5_shogi" : VARIANTS;\r
printf("feature variants=\"%s\" setboard=1 usermove=1 debug=1 ping=1 reuse=0 exclude=1 pause=1 sigint=0 sigterm=0 done=0\n", variants);\r
printf("feature option=\"UCI2WB debug output -check %d\"\n", debug);\r
- if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\" option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo);\r
+ if(sc == 's') printf("feature option=\"Floating Byoyomi -check %d\"\nfeature option=\"Byoyomi -spin %d -1 1000\"\n", flob, byo);\r
fprintf(toE, sc == 'x' ? "ucci\n" : "u%ci\n", sc); fflush(toE); // prompt UCI engine for options\r
Sync(PAUSE); // wait for uciok\r
}\r
else if(!strcmp(command, "sd")) sscanf(line, "sd %d", &depth);\r
else if(!strcmp(command, "st")) sscanf(line, "st %d", &sTime), sTime = 1000*sTime - 30, inc = 0, sTime /= unit;\r
else if(!strcmp(command, "offer")) drawOffer = 1;\r
+ else if(!strcmp(command, "result")) { if(sc == 's') fprintf(toE, "gameover %s\n", line[8] == '/' ? "draw" : (line[7] == '0') == mySide ? "win" : "lose"); }\r
else if(!strcmp(command, "quit")) fprintf(toE, "quit\n"), fflush(toE), exit(0);\r
}\r
}\r