int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/\r
{ /* e=score, z=prev.dest; J,Z=hashkeys; return score*/\r
int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S;\r
- signed char t,p,u,x,y,X,Y,H,B,gt;\r
+ signed char t,p,u,x,y,X,Y,H,B,gt,rg,rk;\r
struct _*a=A+(J+(k+S)*E&U); /* lookup pos. in hash table*/\r
*sp++=0;\r
q-=q<e;l-=l<=e; /* adj. window: delay bonus */\r
W(r=o[++j]) /* loop over directions o[] */\r
{A: /* resume normal after best */\r
flag=h?3:of[j]; /* move modes (for fairies) */\r
- y=x;F=FF=G=S; /* (x,y)=move, (F,G)=castl.R*/\r
+ y=x;F=FF=G=S;rg=flag>>10&3; /* (x,y)=move, (F,G)=castl.R*/\r
do{ /* y traverses ray, or: */\r
H=y=h?Y^h:y+r; /* sneak in prev. best move */\r
if(flag&1<<8)H=y=(y&15)>13?y+BW:(y&15)>=BW?y-BW:y; /* cylinder board */\r
if(d-!t>1) /*** all captures if d=2 ***/\r
{v=gt=0;G: /* retry move with gating */\r
v+=centr[p]?b[x+257]-b[y+257]:0; /* center positional pts. */\r
- if(!(G&S))b[FF]=b[G],v+=50; /* castling: put R & score */\r
+ if(G-S)b[FF]=(rk=b[G])|32,v+=50; /* castling: put R & score */\r
b[G]=b[H]=0;b[x]=gt;b[y]=u|32; /* do move, set non-virgin */\r
pl[t&31]-=!!t; /* updat victim piece count */\r
v-=w[p]>0|R<EG?0:20; /*** freeze K in mid-game ***/\r
v+=e+i;V=m>q?m:q; /*** new eval & alpha ****/\r
if(z&S)V=m-margin>q?m-margin:q; /* multiPV */\r
C=d-1-(d>5&p>2&!t&!h); /* nw depth, reduce non-cpt.*/\r
- C=R<EG|P-I|d<3||t&&p-3?C:d; /* extend 1 ply if in-check */\r
+ C=R<EG|P-I|d<3||t&&w[p]>0?C:d; /* extend 1 ply if in-check */\r
do\r
s=C>2|v>V?-D(16-k,-l,-V,-v,/*** futility, recursive eval. of reply */\r
F,y&255,C):v;\r
{if(v+I&&x==K&y==L>==GT) /* if move found */\r
{Q=-e-i;O=F;LL=L;prom=gt;\r
if(b[y]-u&15)prom=b[y]-=PromPiece, /* (under-)promotion: */\r
- Q-=abs(w[prom&=15])-w[p]-6*S, /* correct piece & score & */\r
+ Q-=abs(w[prom&=15])-w[p]-(6*S>>sh), /* correct piece & score & */\r
Z+=PromPiece; /* invalidate hash */\r
a->D=99;a->V=0; /* lock game in hash as draw*/\r
R-=i/FAC; /*** total captd material ***/\r
v=m; /* (prevent fail-lows on */\r
} /* K-capt. replies) */\r
SHAMAX( pl[k]+=!!t; ) pl[t&31]+=!!t;\r
- b[G]=b[FF];b[FF]=b[y]=0;b[x]=u;b[H]=t; /* undo move,G can be dummy */\r
+ b[G]=rk;b[FF]=b[y]=0;b[x]=u;b[H]=t; /* undo move,G can be dummy */\r
} /* if non-castling */\r
if(z&S&&K==I&d>2&v>V&v<l){int *p=ps;char X,Y;\r
if(Post){\r
)t+=flag&4; /* fake capt. for nonsliding*/\r
else if(flag&64)t=flag&128?0:t,flag&=63;else F=y; /* enable e.p. */\r
if(s&&flag&8)t=0,flag^=flag>>4&15; /* hoppers go to next phase */\r
- if(!(flag&S)) /* zig-zag piece? */\r
+ if(--rg<0&!(flag&S)) /* zig-zag piece? (w. delay)*/\r
r=v,flag^=flag>>4&15; /* alternate vector & mode */\r
}W(!t); /* if not capt. continue ray*/\r
}}\r
/* We have found variant, or if none specified, are at beginning of file */\r
if(fscanf(f, "%dx%d", &BW, &BH)!=2 || BW>12 || BH!=8)\r
{ printf("telluser unsupported board size %dx%d\n",BW,BH); exit(0); }\r
+ makruk = 0; if(fscanf(f, "=%d", &i)) makruk=64; // new method to indicate deviant zone depth (for now assumes 3)\r
\r
for(i=0; i<BW; i++) fscanf(f, "%d", oo+i);\r
for(i=0; i<BW; i++) fscanf(f, "%d", oo+i+16);\r
\r
fclose(f);\r
sh = w[7] < 250 ? 3 : 0;\r
- makruk = w[7]==181 ? 64 : 0; // w[7] is used as kludge to enable makruk promotions\r
if(name == selectedFairy) {\r
printf(ptc == 1 ? "setup " : "setup (%s) ", pieceToChar); // setup board in GUI\r
for(i=0; i<BW; i++) printf("%c", piecename[oo[i+16]]+'`'); printf("/");\r