From: H.G.Muller Date: Thu, 26 Dec 2013 20:54:54 +0000 (+0100) Subject: Send parent variant with setup command X-Git-Url: http://winboard.nl/cgi-bin?p=fairymax.git;a=commitdiff_plain;h=d50bf1dd9d15885041ab284421a9a8297c4cea33 Send parent variant with setup command Implement WinBoard's extended setup command, which also specifies board size and parent variant. The parent variant can be specified in the fmax.ini file behind the pieceToCharTable. Ai-wok and Cambodian now have new definitions making use of this mechanism. To not confuse them with the old definitions, (which remained for backward compatibility), the later are now capitalized. --- diff --git a/data/fmax.ini b/data/fmax.ini index 39e4d14..a903175 100644 --- a/data/fmax.ini +++ b/data/fmax.ini @@ -343,7 +343,7 @@ n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 R:630 1,3 16,3 -1,3 -16,3 // Cambodian Chess. Like Makruk, but with extra initial King and Met moves -Game: cambodian +Game: Cambodian 8x8=3 13 12 8 3 7 8 12 13 13 12 9 7 4 9 12 13 @@ -356,13 +356,52 @@ q:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4 m:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4 s:300 15,7 17,7 -15,7 -17,7 -16,7 s:300 15,7 17,7 -15,7 -17,7 16,7 + b:300 15,7 17,7 -15,7 -17,7 -16,7 b:300 15,7 17,7 -15,7 -17,7 16,7 + n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 R:630 1,3 16,3 -1,3 -16,3 + // Thai Chess variant with Ai-Wok (RNF). -Game: ai-wok +Game: Ai-wok +8x8=3 +6 5 3 8 7 3 5 6 +6 5 4 7 8 4 5 6 +p:100 -16,6 -15,5 -17,5 +p:100 16,6 15,5 17,5 +s:300 15,7 17,7 -15,7 -17,7 -16,7 +s:300 15,7 17,7 -15,7 -17,7 16,7 +n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 +R:630 1,3 16,3 -1,3 -16,3 +A:1350 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7 +k:-1 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 + +// Cambodian Chess using WinBoard's new engine-defined variant mechanism +Game: cambodian # PN.R.M....SKpn.r.m....sk # makruk +8x8=3 +13 12 8 3 7 8 12 13 +13 12 9 7 4 9 12 13 +p:100 -16,6 -15,5 -17,5 +p:100 16,6 15,5 17,5 +k:-1 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 -16,10F4 -16,1F0F4 -1,100F4 1,FFFF00F4 +k:-1 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 16,10F4 16,1F0F4 1,100F4 -1,FFFF00F4 +f:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4 +q:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4 +m:181 15,7 17,7 -15,7 -17,7 16,F4 -16,F4 +s:300 15,7 17,7 -15,7 -17,7 -16,7 +s:300 15,7 17,7 -15,7 -17,7 16,7 + +b:300 15,7 17,7 -15,7 -17,7 -16,7 +b:300 15,7 17,7 -15,7 -17,7 16,7 + +n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 +R:630 1,3 16,3 -1,3 -16,3 + + +// Ai-Wok using WinBoard's new engine-defined variant mechanism +Game: ai-wok # PN.R...A..SKpn.r...a..sk # makruk 8x8=3 6 5 3 8 7 3 5 6 6 5 4 7 8 4 5 6 @@ -372,7 +411,7 @@ s:300 15,7 17,7 -15,7 -17,7 -16,7 s:300 15,7 17,7 -15,7 -17,7 16,7 n:450 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 R:630 1,3 16,3 -1,3 -16,3 -M:1350 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7 +A:1350 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 1,3 16,3 -1,3 -16,3 15,7 17,7 -15,7 -17,7 k:-1 1,7 16,7 15,7 17,7 -1,7 -16,7 -15,7 -17,7 // Medieval intermediate between Shatranj and FIDE Chess diff --git a/fairymax.c b/fairymax.c index 5341cd2..f80bfe3 100644 --- a/fairymax.c +++ b/fairymax.c @@ -342,6 +342,7 @@ int PrintResult(int s) } differs: ; } + K=I; cnt = D(s,-I,I,Q,O,LL|4*S,3); #ifdef SHATRANJ @@ -438,7 +439,7 @@ void PrintVariants(int combo) while((c = fgetc(f)) != EOF && c != '\n'); if(c == EOF) break; total++; - if(combo == (strstr(buf, "fairy/") != buf)) continue; + if(*buf < 'a' || combo == (strstr(buf, "fairy/") != buf)) continue; if(combo && count == 0) strcpy(selectedFairy, buf); if(count++) printf(combo ? " /// " : ","); printf("%s", combo ? buf+6 : buf); @@ -455,7 +456,7 @@ void PrintOptions() printf("feature option=\"Ini File -file %s\"\n", inifile); printf("feature option=\"Multi-PV Margin -spin %d 0 1000\"\n", margin); printf("feature option=\"Variant fairy selects -combo "); PrintVariants(1); printf("\"\n"); - printf("feature option=\"Makruk rules -combo makruk /// cambodian /// ai-wok\"\n"); + printf("feature option=\"Makruk rules -combo makruk /// Cambodian /// Ai-wok\"\n"); printf("feature option=\"Dummy Slider Example -slider 20 0 100\"\n"); printf("feature option=\"Dummy String Example -string happy birthday!\"\n"); printf("feature option=\"Dummy Path Example -path .\"\n"); @@ -465,7 +466,7 @@ void PrintOptions() void LoadGame(char *name) { - int i, j, ptc, count=0; char c, buf[80], pieceToChar[80]; + int i, j, ptc, count=0; char c, buf[80], pieceToChar[80], parent[80]; static int currentVariant; FILE *f; @@ -483,7 +484,7 @@ void LoadGame(char *name) if(!strcmp(name, "makruk")) name = Cambodian; else if(!strcmp(name, "fairy")) name = selectedFairy; gating = !strcmp(name, "seirawan"); - while((ptc=fscanf(f, "Game: %s # %s", buf, pieceToChar))==0 || strcmp(name, buf) ) { + while((ptc=fscanf(f, "Game: %s # %s # %s", buf, pieceToChar, parent))==0 || strcmp(name, buf) ) { while((c = fgetc(f)) != EOF && c != '\n'); count++; if(c == EOF) { @@ -522,8 +523,9 @@ void LoadGame(char *name) fclose(f); sh = w[7] < 250 ? 3 : 0; - if(name == selectedFairy || makruk) { - printf(ptc == 1 ? "setup " : "setup (%s) ", pieceToChar); // setup board in GUI + if(ptc > 1) { // setup board in GUI, by sending it pieceToCharTable and FEN + if(ptc == 2) printf("setup (%s) ", pieceToChar); + else printf("setup (%s) %dx%d+0_%s ", pieceToChar, BW, BH, parent); for(i=0; i