X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=dfa3ea61bbb0e5861a7efcef4f5cf76d4a8fd4fa;hb=c62ef367da4863f395624f3eb02cc9f215b42ada;hp=98ff2cfb50aac3a2d397cabc9ceeee8f1b78460e;hpb=58bbc6e831d3989c22e6e6ce1e869224355b9f0e;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 98ff2cf..dfa3ea6 100644 --- a/fairymax.c +++ b/fairymax.c @@ -18,7 +18,7 @@ /*****************************************************************/ #define MULTIPATH -#define VERSION "4.8Q" +#define VERSION "4.8R" #include #include @@ -68,10 +68,10 @@ int StartKey; #endif /* make unique integer from engine move representation */ -#define PACK_MOVE 256*K + L + (PromPiece << 16); +#define PACK_MOVE 256*K + L + (PromPiece << 16) + (GT<<24); /* convert intger argument back to engine move representation */ -#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; PromPiece = (A)>>16 & 255; +#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; PromPiece = (A)>>16 & 255; GT = (A)>>24 & 255; /* Global variables visible to engine. Normally they */ /* would be replaced by the names under which these */ @@ -90,6 +90,7 @@ int Fifty; int UnderProm; int GameNr; int Resign; +int Cambodian; int Threshold = 800; int Score; int makruk; @@ -221,7 +222,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ {if(v+I&&x==K&y==L>==GT) /* if move found */ {Q=-e-i;O=F;LL=L;prom=gt; if(b[y]-u&15)prom=b[y]-=PromPiece, /* under-promotion, correct */ - J+=PromPiece; /* piece & invalidate hash */ + Z+=PromPiece; /* piece & invalidate hash */ a->D=99;a->V=0; /* lock game in hash as draw*/ R-=i/FAC; /*** total captd material ***/ Fifty = t|p<3?0:Fifty+1; @@ -441,6 +442,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=\"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,6 +467,7 @@ int LoadGame(char *name) gating = 0; if(name != NULL) { /* search for game name in definition file */ + if(!strcmp(name, "makruk") && Cambodian) 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) ) { @@ -605,7 +608,7 @@ int main(int argc, char **argv) if (!strcmp(command, "protover")) { printf("feature myname=\"" NAME " " VERSION "\"\n"); printf("feature memory=1\n"); - printf("feature setboard=0 ping=1 done=0\n"); + printf("feature setboard=0 xedit=1 ping=1 done=0\n"); printf("feature variants=\""); PrintVariants(0); printf("\"\n"); @@ -732,6 +735,7 @@ int main(int argc, char **argv) if(sscanf(line+7, "Clear Hash") == 1) 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; continue; } if (!strcmp(command, "go")) { @@ -811,11 +815,18 @@ int main(int argc, char **argv) Q = -Q; continue; } - if( m >= 'A' && m <= 'Z' && piecetype[m&31] - && line[1] >= 'a' && line[1] <= 'a'+BW-1 + if( m >= 'A' && m <= 'Z' && piecetype[m&31]) { + p = (color == WHITE ? piecetype : blacktype)[line[0]&31]; + if(line[1] == '@') { // stuff holdings + pl[color+p+5] = m = line[2] - '0'; + pl[BLACK+WHITE-color]+=m;pl[p+color]+=m; + Q+=m*w[p]; R+=m*(w[p]/FAC); + continue; + } else + if(line[1] >= 'a' && line[1] <= 'a'+BW-1 && line[2] >= '1' && line[2] <= '0'+BH) { m = line[1]-16*line[2]+799; - switch(p = (color == WHITE ? piecetype : blacktype)[line[0]&31]) + switch(p) { case 1: case 2: @@ -827,21 +838,19 @@ int main(int argc, char **argv) break; default: b[m]=p+color+32; // assume non-virgin + if(color==BLACK && m<0x10 && p==oo[m+16] || // but make virgin on original square + color==WHITE && m>0x6F && p==oo[m-0x70]) b[m] -= 32; if(w[p]<0) { // Royal piece on original square: virgin - if(color==BLACK && m<0x10 && p==oo[m+16] || - color==WHITE && m>0x6F && p==oo[m-0x70]) b[m] -= 32; Q-=w[p]; // assume value was flipped to indicate royalty if(pl[p+color])R-=w[p]/FAC; // capturable King, add to material } else { Q+=w[p]; R+=w[p]/FAC; } - if((m==0x00 || m==BW-1 ) && color==BLACK && p==oo[m+16] || - (m==0x70 || m==0x6F+BW) && color==WHITE && p==oo[m-0x70]) - b[m] &= ~32; // corner piece as in original setup: virgin case 0: // undefined piece, ignore break; } pl[BLACK+WHITE-color]++;pl[p+color]++; if(w[p+color] == -1)pl[p+color]=1; // fake we have one if value = -1, to thwart extinction condition continue; + } } } if(Side != color) Q = -Q;