X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=UCI2WB.c;h=079960da69fbb8172be800e13aa20908853f4071;hb=bdbb7ca818c7bad56686832eba6706458aae88bd;hp=9b197bbce5f1e4168c254cbf43b4292e271cc2ae;hpb=291c1c2fdf76767c159c8a4ae2a24dbc5916ac51;p=uci2wb.git diff --git a/UCI2WB.c b/UCI2WB.c index 9b197bb..079960d 100644 --- a/UCI2WB.c +++ b/UCI2WB.c @@ -9,7 +9,7 @@ /* of which you should have received a copy together with this file. */ /****************************************************************************/ -#define VERSION "2.2" +#define VERSION "2.3" #include #include @@ -51,6 +51,8 @@ FILE *toE, *fromE, *fromF; int pid; #ifdef WIN32 +char *strcasestr (char *p, char *q) { char *r = p; while(*r) *r = tolower(*r), r++; return strstr(p, q); } + WinPipe(HANDLE *hRd, HANDLE *hWr) { SECURITY_ATTRIBUTES saAttr; @@ -276,8 +278,12 @@ Engine2GUI() } else if(!strcmp(command, "info")) { int d=0, s=0, t=(GetTickCount() - startTime)/10, n=1; - char *pv; + char *pv, varName[80]; if(sscanf(line+5, "string times @ %c", &dummy) == 1) { printf("# %s", line+12); continue; } + if(sscanf(line+5, "string variant %s", varName) == 1) { + if(strcmp(varName,"chess") && (p = strstr(line+18, " startpos "))) printf("setup (-) 8x8+0_fairy %s", p+10); + continue; + } if(collect && (pv = strstr(line+5, "currmove "))) { if(p = strstr(line+5, "currmovenumber ")) { n = atoi(p+15); @@ -481,7 +487,10 @@ GUI2Engine() iniPos[strlen(iniPos)-1] = sm = 0; collect = (computer == ANALYZE); } else if(!strcmp(command, "variant")) { - if(varOpt) fprintf(toE, "setoption name UCI_Variant value %sucinewgame\n", strcmp(line+8, "3check\n") ? line+8 : "threecheck\n"); + if(varOpt) { + fprintf(toE, "setoption name UCI_Variant value %sucinewgame\nisready\n", strcmp(line+8, "3check\n") ? line+8 : "threecheck\n"); + fflush(toE); Sync(PAUSE); + } if(!strcmp(line+8, "shogi\n")) size = 9, strcpy(iniPos, "position startpos"); if(!strcmp(line+8, "5x5+5_shogi\n")) size = 5, strcpy(iniPos, "position startpos"); if(!strcmp(line+8, "xiangqi\n")) strcpy(iniPos, "fen rnbakabnr/9/1c5c1/p1p1p1p1p/9/9/P1P1P1P1P/1C5C1/9/RNBAKABNR r");