From b170de109dfcfa9db25c93006f9e1ef417243aa9 Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Wed, 13 Feb 2013 19:39:02 +0100 Subject: [PATCH] Fix promotion bonus In its search Fairy-Max always promotes to 'Queen' ad 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 | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/changelog b/changelog index 6431c94..e8a3654 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 + * Adapt score by true piece value in case of (under-)promotion In addition it prints msec-accurate timing info. diff --git a/fairymax.c b/fairymax.c index 15a5ce5..6f420ae 100644 --- a/fairymax.c +++ b/fairymax.c @@ -231,8 +231,9 @@ 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>==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 */ - Z+=PromPiece; /* piece & invalidate hash */ + if(b[y]-u&15)prom=b[y]-=PromPiece, /* (under-)promotion: */ + Q-=abs(w[prom&=15])-w[p]-6*S, /* correct piece & score & */ + Z+=PromPiece; /* 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; @@ -582,7 +583,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); + if(prom)printf("%c",piecename[prom]+'a'-1); printf("\n"); /* time-control accounting */ -- 1.7.0.4