X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=e615fd4064863efa5d03562f8323da3c92e933a8;hb=72b198f0b7575ff63748b7c02b1572ed162aef04;hp=b5086d5fd0d0e1f0cf25bd2d85324a2d71859c9b;hpb=af07349064b580cfaba648a5395a64e6b73d7f9f;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index b5086d5..e615fd4 100644 --- a/fairymax.c +++ b/fairymax.c @@ -18,7 +18,7 @@ /*****************************************************************/ #define MULTIPATH -#define VERSION "4.8N" +#define VERSION "4.8O" #include #include @@ -184,8 +184,8 @@ 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=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 */ b[G]=b[H]=b[x]=0;b[y]=u|32; /* do move, set non-virgin */ - if(!(G&S))b[FF]=k+6,v+=50; /* castling: put R & score */ v-=w[p]>0|R2&v>V&v>8;Y=*p++; printf(" %c%c%c%c",'a'+(X&15),'8'-(X>>4),'a'+(Y&15),'8'-(Y>>4&7));} printf("\n");fflush(stdout); - } if(v>m) /* new best, update max,best*/ + } + if(v>m) /* new best, update max,best*/ m=v,X=x,Y=y|S&F; /* mark non-double with S */ if(h){h=0;goto A;} /* redo after doing old best*/ } - s=t; + s=t;v=r^flag>>12; /* calc. alternated vector */ if(flag&15^4|u&32|| /* no double or moved before*/ p>2&& /* no P & no lateral K move,*/ ((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=r<0?G+3:G-2]) /* no 2 empty sq. next to R */ + ||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 F=y; /* enable e.p. */ if(s&&flag&8)t=0,flag^=flag>>4&15; /* hoppers go to next phase */ if(!(flag&S)) /* zig-zag piece? */ - r^=flag>>12,flag^=flag>>4&15; /* alternate vector & mode */ + r=v,flag^=flag>>4&15; /* alternate vector & mode */ }W(!t); /* if not capt. continue ray*/ }} if((++x&15)>=BW)x=x+16&112; /* next sqr. of board, wrap */ @@ -318,10 +319,31 @@ int PrintResult(int s) } K=I; cnt = D(s,-I,I,Q,O,LL|4*S,3); +#ifdef SHATRANJ + if(pl[s]==1 && pl[16-s]==1) { + printf("1/2-1/2 {Insufficient mating material}\n"); + return 4; + } + if(pl[s]<=1 && pl[16-s]>1) { + if (s == BLACK) + printf("0-1 {Bare King}\n"); + else + printf("1-0 {Bare King}\n"); + return 5; + } + if(cnt>-I+1 && K==0 && L==0) { + if (s == WHITE) + printf("0-1 {Stalemate}\n"); + else + printf("1-0 {Stalemate}\n"); + return 2; + } +#else if(cnt>-I+1 && K==0 && L==0) { printf("1/2-1/2 {Stalemate}\n"); return 2; } +#endif if(cnt==-I+1) { if (s == WHITE) printf("0-1 {Black mates}\n"); @@ -333,19 +355,6 @@ int PrintResult(int s) printf("1/2-1/2 {Draw by fifty move rule}\n"); return 4; } -#ifdef SHATRANJ - if(pl[s]==1 && pl[16-s]==1) { - printf("1/2-1/2 {Insufficient mating material}\n"); - return 4; - } - if(pl[s]<=1 && pl[16-s]>1) { - if (s == BLACK) - printf("0-1 {Bare King}\n"); - else - printf("1-0 {Bare King}\n"); - return 5; - } -#endif return 0; } @@ -614,12 +623,14 @@ int main(int argc, char **argv) } if (!strcmp(command, "white")) { /* set white to move in current position */ + if(Side == BLACK) Q = -Q; Side = WHITE; Computer = BLACK; continue; } if (!strcmp(command, "black")) { /* set blck to move in current position */ + if(Side == WHITE) Q = -Q; Side = BLACK; Computer = WHITE; continue;