From: H.G. Muller Date: Wed, 13 Feb 2013 22:22:03 +0000 (+0100) Subject: Fix promotion bonus X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=319c6cd9990e350a23689b30053b25660c2c3d8f;p=fairymax.git Fix promotion bonus In its search Fairy-Max always promotes to 'Queen' and gives itself 768 cP bonus for that. (Which is about right for the original micro-Max Q=851 and P=74.) The opponent can do under-promotion to a piece of wildly different value, though, and this was not corrected. It is now corrected at game level (which is the only place it can happen). --- diff --git a/changelog b/changelog index 6431c94..081204f 100644 --- a/changelog +++ b/changelog @@ -112,5 +112,6 @@ * Fix bug in Berolina e.p. capture that is actually non-capture * Fix Clear Hash option, which did not work at all * Fix addition of 6th & 7th-rank Pawn bonus when setting up position + * set promotion bonus on (under-)promotion to true piece value In addition it prints msec-accurate timing info. diff --git a/fairymax.c b/fairymax.c index bdb76e4..b236e4d 100644 --- a/fairymax.c +++ b/fairymax.c @@ -232,8 +232,9 @@ int k,q,l,e,ev,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>==GT) /* if move found */ {Q=-e-i;O=F;LL=L;prom=gt; - if(b[y]-u&15)prom=b[y]-=PromPiece, /* under-promotion, correct */ - pl[u&31]--,pl[prom&31]++,Z+=PromPiece;/*piece & invalidate hash */ + if(b[y]-u&15)prom=b[y]-=PromPiece, /* (under-)promotion: */ + Q-=abs(w[prom&=31])-w[p]-6*S, /* correct piece & score & */ + pl[u&31]--,pl[prom]++,Z+=PromPiece; /* count & invalidate hash */ a->D=99;a->V=0; /* lock game in hash as draw*/ R-=i/FAC; /*** total captd material ***/ Fifty = t|p<3?0:Fifty+1;