X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=fairymax.c;h=6305a449b2c23b7dd3cc81578dbe5c87f6ea632e;hb=18e3a22339d477d3d27550a9fe49aaaed0c14fff;hp=92bf8a9616f304905b9cc3e65b9025fb4c0b469d;hpb=518211a4310898171d8bb4e0a865f97e9cbda28a;p=fairymax.git diff --git a/fairymax.c b/fairymax.c index 92bf8a9..6305a44 100644 --- a/fairymax.c +++ b/fairymax.c @@ -93,6 +93,7 @@ int Resign; int Threshold = 800; int Score; int makruk; +int prom; char piecename[32], piecetype[32], blacktype[32]; char *inifile = INI_FILE; @@ -214,8 +215,8 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ } if(z&S&&K-I) /* move pending: check legal*/ {if(v+I&&x==K&y==L) /* if move found */ - {Q=-e-i;O=F;LL=L; - if(b[y]-u&15)b[y]-=PromPiece, /* under-promotion, correct */ + {Q=-e-i;O=F;LL=L;prom=0; + if(b[y]-u&15)prom=b[y]-=PromPiece, /* under-promotion, correct */ J+=PromPiece; /* piece & invalidate hash */ a->D=99;a->V=0; /* lock game in hash as draw*/ R-=i/FAC; /*** total captd material ***/ @@ -319,10 +320,24 @@ 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; + } +#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"); @@ -334,19 +349,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; } @@ -528,6 +530,7 @@ int main(int argc, char **argv) printf("move "); printf("%c%c%c%c",'a'+(K&15),'0'+BH-(K>>4), 'a'+(L&15),'0'+BH-(L>>4)); + if(prom)printf("%c",piecename[prom&15]+'a'-1); printf("\n"); m = GetTickCount() - Ticks; @@ -615,12 +618,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;