From 333c8eaf87edaf58a99775e26a72e19315c6e0a4 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Thu, 16 May 2013 19:14:47 +0200 Subject: [PATCH] Mark castling Rook as non-virgin The Rook was left virgin when castling. This could cause erroneous gating in variant seirawan. Now the original piece is remembered in a variable rk, from which it can be restored, while the on-board (moved) Rook wil get the virginity bit set. Separate storage was preferred over clearing the bit on take-back, because it allows the same code to also handle other removal of pieces a a side effect of a move, by setting G to the piece to be removed. --- fairymax.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fairymax.c b/fairymax.c index 3bd0c69..560f64d 100644 --- a/fairymax.c +++ b/fairymax.c @@ -149,7 +149,7 @@ D(k,q,l,e,E,z,n) /* recursive minimax search, k=moving side, n=depth*/ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ { /* e=score, z=prev.dest; J,Z=hashkeys; return score*/ int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S; - signed char t,p,u,x,y,X,Y,H,B,gt,rg; + signed char t,p,u,x,y,X,Y,H,B,gt,rg,rk; struct _*a=A+(J+(k+S)*E&U); /* lookup pos. in hash table*/ *sp++=0; q-=q1) /*** all captures if d=2 ***/ {v=gt=0;G: /* retry move with gating */ v+=centr[p]?b[x+257]-b[y+257]:0; /* center positional pts. */ - if(!(G&S))b[FF]=b[G],v+=50; /* castling: put R & score */ + if(G-S)b[FF]=(rk=b[G])|32,v+=50; /* castling: put R & score */ b[G]=b[H]=0;b[x]=gt;b[y]=u|32; /* do move, set non-virgin */ pl[t&31]-=!!t; /* updat victim piece count */ v-=w[p]>0|R2&v>V&v