Supply time and node count for engines that do not give it
[uci2wb.git] / UCI2WB.c
index c69971f..29d4040 100644 (file)
--- a/UCI2WB.c
+++ b/UCI2WB.c
@@ -271,7 +271,7 @@ Engine2GUI()
            if(lastScore == 100001 && iniPos[0] != 'f') { printf("%s {mate}\n", stm == BLACK ? "1-0" : "0-1"); computer = NONE; }\r
        }\r
        else if(!strcmp(command, "info")) {\r
-           int d=0, s=0, t=0, n=0;\r
+           int d=0, s=0, t=(GetTickCount() - startTime)/10, n=1;\r
            char *pv;\r
            if(sscanf(line+5, "string times @ %c", &dummy) == 1) { printf("# %s", line+12); continue; }\r
            if(collect && (pv = strstr(line+5, "currmove "))) {\r
@@ -308,6 +308,9 @@ Engine2GUI()
            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(frc< 0 && (strstr(name, "960") || strcasestr(name, "frc")) && !strcmp(type, "check")) {\r
+               fprintf(toE, "setoption name %s value true\n", name); strcpy(val, "true"); // set non-standard suspected FRC options\r
+           }\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
@@ -338,8 +341,9 @@ Engine2GUI()
            if(buf[0]) printf("%s", buf);\r
        }\r
        else if(!strcmp(command, "id")) {\r
-           char name[256];\r
+           static char name[256], version[256];\r
            if(sscanf(line, "id name %[^\n]", name) == 1) printf("feature myname=\"%s (U%cI2WB)\"\n", name, sc-32);\r
+           if(sscanf(line, "id version %[^\n]", version) == 1 && *name) printf("feature myname=\"%s %s (U%cI2WB)\"\n", name, version, sc-32);\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
@@ -400,7 +404,7 @@ GUI2Engine()
        if(!strcmp(command, "new")) {\r
            computer = BLACK; moveNr = 0; depth = -1; move[0][0] = 0;\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
+           if(memory != oldMem && hasHash) fprintf(toE, "setoption %s%s %s%d\n", nameWord, hashOpt, valueWord, memory);\r
            oldMem = memory;\r
            // we can set other options here\r
            if(sc == 'x') { if(newGame) fprintf(toE, "setoption newgame\n"); } else // optional in UCCI\r