X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=f476379599ab2d70e07924d245ef7c39c84ca800;hb=e1316b1f8666776e17ab816faf28622306aa56e8;hp=560f64d75b8d2afba63409846209ebb1075ceb99;hpb=333c8eaf87edaf58a99775e26a72e19315c6e0a4;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 560f64d..f476379 100644 --- a/fairymax.c +++ b/fairymax.c @@ -18,7 +18,7 @@ /*****************************************************************/ #define MULTIPATH -#define VERSION "4.8S" +#define VERSION "4.8T" #include #include @@ -100,7 +100,7 @@ int Post; int Fifty; int GameNr; int Resign; -int Cambodian; +char Cambodian[80] = "makruk"; int Threshold = 800; int Score; int makruk; @@ -342,6 +342,11 @@ int PrintResult(int s) } differs: ; } + + + + + K=I; cnt = D(s,-I,I,Q,O,LL|4*S,3); #ifdef SHATRANJ @@ -438,7 +443,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 +460,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=\"Cambodian Makruk rules -check %d\"\n", Cambodian); + 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 +470,7 @@ void PrintOptions() void LoadGame(char *name) { - int i, j, ptc, count=0; char c, buf[80], pieceToChar[80]; + int i, j, ptc=0, count=0; char c, buf[80], pieceToChar[80], parent[80]; static int currentVariant; FILE *f; @@ -480,10 +485,10 @@ void LoadGame(char *name) gating = succession = 0; if(name != NULL) { /* search for game name in definition file */ - if(!strcmp(name, "makruk") && Cambodian) name = "cambodian"; else + 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) { @@ -498,6 +503,7 @@ void LoadGame(char *name) /* We have found variant, or if none specified, are at beginning of file */ if(fscanf(f, "%dx%d", &BW, &BH)!=2 || BW>12 || BH!=8) { printf("telluser unsupported board size %dx%d\n",BW,BH); exit(0); } + makruk = 0; if(fscanf(f, "=%d", &i)) makruk=64; // new method to indicate deviant zone depth (for now assumes 3) for(i=0; i15 || j>255) break; } - fclose(f); sh = w[7] < 250 ? 3 : 0; - makruk = w[7]==181 ? 64 : 0; // w[7] is used as kludge to enable makruk promotions - if(name == selectedFairy) { - 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; iK = 0; if(sscanf(line+7, "MultiVariation Margin=%d", &margin) == 1) continue; if(sscanf(line+7, "Variant fairy selects=%s", selectedFairy+6) == 1) continue; - if(sscanf(line+7, "Cambodian Makruk rules=%d", &Cambodian) == 1) continue; + if(sscanf(line+7, "Makruk rules=%s", Cambodian) == 1) continue; continue; } if (!strcmp(command, "go")) { @@ -899,6 +908,8 @@ int main(int argc, char **argv) CopyBoard(HistPtr=HistPtr+1&1023); if(PrintResult(Side)) Computer = EMPTY; } + } } + return 0; }