From 319c6cd9990e350a23689b30053b25660c2c3d8f Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 13 Feb 2013 23:22:03 +0100 Subject: [PATCH] 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). --- changelog | 1 + fairymax.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) 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; -- 1.7.0.4