X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=9b3adc7daa45ab1c569d85e6404248fc63459ed6;hb=3f3fc8b97c2ae601d6d437647561be4d954a4fb8;hp=72dba19ca4797724eafa1feb36741cf748b6e106;hpb=728531bf7750e620134e7b1abcc9f72c81f1f3f7;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 72dba19..9b3adc7 100644 --- a/fairymax.c +++ b/fairymax.c @@ -104,7 +104,7 @@ char Cambodian[80] = "makruk"; int Threshold = 800; int Score; int makruk; -int prom, pm, gating, succession; +int prom, pm, gating, succession, hill; char piecename[32], piecetype[32], blacktype[32]; char selectedFairy[80]; char *inifile = INI_FILE; @@ -170,6 +170,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ do{u=b[x]; /* scan board looking for */ if(u&&(u&16)==k) /* own piece (inefficient!)*/ {r=p=u&15; /* p = piece type (set r>0) */ + if(hill&&w[p]<0&b[385+x])m=I,d=98; /* King on the hill: we won */ j=od[p]; /* first step vector f.piece*/ W(r=o[++j]) /* loop over directions o[] */ {A: /* resume normal after best */ @@ -198,7 +199,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ v=d-1?e:i-p; /*** MVV/LVA scoring if d=1**/ if(d-!t>1) /*** 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. */ + v+=centr[p]*(b[x+257]-b[y+257]); /* center positional pts. */ 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 */ @@ -265,15 +266,15 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ J=f;Z=g; if(h){h=0;goto A;} /* redo after doing old best*/ } - s=t;v=r^flag>>12; /* calc. alternated vector */ + s=t;v=r^flag>>12; /* capt & alternated vector */ if(flag&15^4|u&32|| /* no double or moved before*/ p>2&!(flag&S)&& /* no P & no virgin jump, */ ((b[G=r<0?x&~15:BW-1|x&112]^32)<33 /* no virgin R in corner G, */ ||b[G^1]|b[G^2]|b[FF=y+v-r]) /* no 2 empty sq. next to R */ )t+=flag&4; /* fake capt. for nonsliding*/ else if(flag&64)t=flag&128?0:t,flag&=63;else F=y; /* enable e.p. */ - if(s&&flag&8)t=0,flag^=flag>>4&15; /* hoppers go to next phase */ - if(--rg<0&!(flag&S)) /* zig-zag piece? (w. delay)*/ + if(s&&flag&8&&!(y-=rg*r,t=0) /* hoppers go to next phase */ + ||!(flag&S)&&--rg<0) /* zig-zag piece? (w. delay)*/ r=v,flag^=flag>>4&15; /* alternate vector & mode */ }W(!t); /* if not capt. continue ray*/ }} @@ -400,8 +401,9 @@ void InitGame() pl[oo[K+16]+16]++;pl[oo[K]]++;pl[18]++;pl[1]++; if(w[oo[K+16]+16] == -1)pl[oo[K+16]+16]=1; 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 */ + L=8;W(L--)b[16*L+K+257]=(K-BW/2+hill/2.)*(K-BW/2+hill/2.)+(L-3.5)*(L-3.5); /* center-pts table */ } /*(in unused half b[])*/ + b[385+16*3+BW/2]=b[385+16*4+BW/2]=b[385+16*3+BW/2-1]=b[385+16*4+BW/2-1]=1; /* hill */ for(i=0; i15 || j>255) break; } - sh = w[7] < 250 ? 3 : 0; + sh = w[7] < 250 ? 3 : 0; hill = (w[3] == -2); 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); @@ -579,6 +581,7 @@ int main(int argc, char **argv) if(tlim>TimeLeft/15) tlim = TimeLeft/15; PromPiece = 0; /* Always promote to Queen ourselves */ N=0;K=I; + if(hill) centr[3] = R>20 ? 1 : 22-R; if (D(Side,-I,I,Q,O,LL|S,3)==I) { Side ^= BLACK^WHITE; m = GetTickCount() - Ticks;