X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=072e67fbefa830312564e80dba606ea508d96178;hb=624ef92257cf0512856552f09080c68fdae1f6ee;hp=be12a636279764b809f1853411cd56d32193432e;hpb=9fe97e3c568358c3402af44cefb8999e8fb6581d;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index be12a63..072e67f 100644 --- a/fairymax.c +++ b/fairymax.c @@ -68,10 +68,10 @@ int StartKey; #endif /* make unique integer from engine move representation */ -#define PACK_MOVE 256*K + L; +#define PACK_MOVE 256*K + L + (PromPiece << 16); /* convert intger argument back to engine move representation */ -#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; +#define UNPACK_MOVE(A) K = (A)>>8 & 255; L = (A) & 255; PromPiece = (A)>>16 & 255; /* Global variables visible to engine. Normally they */ /* would be replaced by the names under which these */ @@ -225,6 +225,8 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ R-=i/FAC; /*** total captd material ***/ Fifty = t|p<3?0:Fifty+1; sp=ps; + if(!(u&32)&PromPiece&(K&112)==(k?0:112)) + prom=b[K]=39+k-PromPiece,J+=333,pl[k+14-PromPiece]--; /* gating */ return l;} /* & not in check, signal */ v=m; /* (prevent fail-lows on */ } /* K-capt. replies) */ @@ -366,8 +368,10 @@ InitEngine() InitGame() { - int i,j; + int i,j,k=0; + Side = WHITE; Q=0; O=S; + Fifty = 0; R = 0; for(i=0;i<16*BH;i++)b[i]=0; for(i=0;i<32;i++)pl[i]=0; K=BW;W(K--) @@ -377,10 +381,13 @@ InitGame() if(w[oo[K]] == -1)pl[oo[K]]=1; L=8;W(L--)b[16*L+K+257]=(K-BW/2)*(K-BW/2)+(L-3.5)*(L-3.5); /* center-pts table */ } /*(in unused half b[])*/ - Side = WHITE; Q=0; O=S; - Fifty = 0; R = 0; - for(i=0; iTimeLeft/15) tlim = TimeLeft/15; PromPiece = 0; /* Always promote to Queen ourselves */ + if(pl[Side+13])PromPiece=1;else if(pl[Side+15])PromPiece=-1; /* S-Chess gating */ N=0;K=I; if (D(Side,-I,I,Q,O,LL|S,3)==I) { Side ^= BLACK^WHITE; + if(b[K]&&Score+D(Side,-I,I,Q,2*S,2*S,2)>S) + prom=b[K]=0,J-=333,pl[30-Side-PromPiece]++; /* undo bad gating */ if(UnderProm>=0 && UnderProm != L) { printf("tellics I hate under-promotions!\n"); printf("resign { underpromotion } \n"); @@ -774,6 +784,7 @@ int main(int argc, char **argv) sscanf(line, "variant %s", command); LoadGame(command); InitGame(); Setup = 0; + if(strstr(command,"seirawan")) pl[13] = pl[15] = pl[29] = pl[31] = 1, R += 2*(w[6]/FAC + w[8]/FAC); continue; } if (!strcmp(command, "edit")) { @@ -833,6 +844,7 @@ int main(int argc, char **argv) setupPosition[128] = Side; setupPosition[129] = R; for(i=0; i<32; i++) setupPosition[i+130] = pl[i]; + Computer = EMPTY; // after edit: force mode! continue; } /* command not recognized, assume input move */