\r
char move[2000][10], checkOptions[8192], iniPos[256], hashOpt[20], pause, pondering, suspended, ponder, post, hasHash, c, sc='c', *suffix, *variants;\r
int mps, tc, inc, sTime, depth, myTime, hisTime, stm, computer = NONE, memory, oldMem=0, cores, moveNr, lastDepth, lastScore, startTime, debug;\r
-int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500];\r
+int statDepth, statScore, statNodes, statTime, currNr, size, collect, nr, sm, inex, on[500], frc;\r
char currMove[20], moveMap[500][10], /* for analyze mode */ canPonder[20], threadOpt[20];\r
char board[100]; // XQ board for UCCI\r
char *nameWord = "name ", *valueWord = "value ", *wTime = "w", *bTime = "b", *wInc = "winc", *bInc = "binc", newGame; // keywords that differ in UCCI\r
if(p = strstr(line+6, " max ")) sscanf(p+1, "max %d", &max), *p = '\n';\r
if(p = strstr(line+6, " default ")) sscanf(p+1, "default %[^\n]*", val), *p = '\n';\r
if(!(p = strstr(line+6, " name "))) p = line+1; sscanf(p+6, "%[^\n]", name); // 'name' is omitted in UCCI\r
+ if(!strcasecmp(name, "UCI_Chess960")) { frc=2; continue; }\r
if(!strcasecmp(name, "Threads")) { strcpy(threadOpt, name); continue; }\r
if(!strcasecmp(name, "Ponder") || !strcasecmp(name, "USI_Ponder")) { strcpy(canPonder, name); continue; }\r
if(!strcasecmp(name, "Hash") || !strcasecmp(name, "USI_Hash") || !strcasecmp(name, "hashsize")) {\r
}\r
else if(!strcmp(command, "readyok")) { pause = 0; Sync(WAKEUP); } // resume processing of GUI commands\r
else if(sc == 'x'&& !strcmp(command, "ucciok") || sscanf(command, "u%ciok", &c)==1 && c==sc) {\r
+ if(frc) printf("feature variants=\"normal,fischerandom\" oocastle=%d\n", frc<0); // unannounced FRC uses O-O castling\r
printf("feature smp=1 memory=%d done=1\n", hasHash);\r
if(unit == 2) unit = 1, fprintf(toE, "setoption usemillisec true\n");\r
Sync(WAKEUP); // done with options\r
sscanf(line, "%s", command);\r
if(!strcmp(command, "new")) {\r
computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0;\r
- stm = WHITE; strcpy(iniPos, "position startpos");\r
+ stm = WHITE; strcpy(iniPos, "position startpos"); frc &= ~1;\r
if(memory != oldMem && hasHash) fprintf(toE, "setoption name %s %s%d\n", hashOpt, valueWord, memory);\r
oldMem = memory;\r
// we can set other options here\r
if(pondering || computer == ANALYZE) {\r
if(pondering && !strcmp(command, move[moveNr])) { // ponder hit\r
char *draw = drawOffer ? " draw" : ""; drawOffer = 0;\r
- pondering = 0; moveNr++; startTime = GetTickCount(); // clock starts running now\r
- fprintf(toE, "ponderhit%s\n", draw); DPRINT("# ponderhit%s\n", draw);\r
- fflush(toE); fflush(stdout); pause = 2; Sync(PAUSE); // block input during thinking\r
+ pondering = 0; pause = 2; moveNr++; startTime = GetTickCount(); // clock starts running now\r
+ fprintf(toE, "ponderhit%s\n", draw); DPRINT("# ponderhit%s\n", draw); fflush(toE); fflush(stdout);\r
+ Sync(PAUSE); // block input during thinking\r
goto nomove;\r
}\r
StopPonder(1);\r
else r = strchr(strchr(q+4, ' ') + 1, ' '); // skip to second space (after e.p. square)\r
*r = 0; sprintf(command, "%s%s %s %s", line+9, q+1, p, r+1);\r
} else strcpy(command, line+9);\r
+ if(frc == -1 && (p = strchr(command, ' '))) strncpy(p+3, "KQkq", 4); // unannounced FRC\r
sprintf(iniPos, "%s%sfen %s", iniPos[0]=='p' ? "position " : "", sc=='s' ? "s" : "", command);\r
iniPos[strlen(iniPos)-1] = sm = 0; collect = (computer == ANALYZE);\r
}\r
if(!strcmp(line+8, "shogi\n")) size = 9, strcpy(iniPos, "position startpos");\r
if(!strcmp(line+8, "5x5+5_shogi\n")) size = 5, strcpy(iniPos, "position startpos");\r
if(!strcmp(line+8, "xiangqi\n")) strcpy(iniPos, "fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR r");\r
+ if(!strcmp(line+8, "fischerandom\n")) { frc |= 1; if(frc > 0) fprintf(toE, "setoption name UCI_Chess960 value true\n"); }\r
}\r
else if(!strcmp(command, "undo") && (i=1) || !strcmp(command, "remove") && (i=2)) {\r
if(pondering || computer == ANALYZE) StopPonder(1);\r
if(argc > 3) suffix = argv[3];\r
\r
if(sc == 'x') nameWord = valueWord = bTime = "", wTime = "opp", bInc = "increment", wInc = "oppincrement", unit = 1000; // switch to UCCI keywords\r
+ else if(sc == 'f' ) frc = -1, sc = 'c'; // UCI for unannounced Chess960\r
+ else if(sc == 'n') sc = 'c'; // UCI for normal Chess\r
\r
// spawn engine proc\r
if(StartEngine(argv[1], dir) != NO_ERROR) { perror(argv[1]), exit(-1); }\r