Fix promotion bonus
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 13 Feb 2013 18:39:02 +0000 (19:39 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Wed, 13 Feb 2013 22:13:00 +0000 (23:13 +0100)
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
fairymax.c

index 6431c94..e8a3654 100644 (file)
--- a/changelog
+++ b/changelog
           * 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.
 
index 15a5ce5..6f420ae 100644 (file)
@@ -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*/\r
         {if(v+I&&x==K&y==L&gt==GT)             /*   if move found          */\r
          {Q=-e-i;O=F;LL=L;prom=gt;\r
-          if(b[y]-u&15)prom=b[y]-=PromPiece,   /* under-promotion, correct */\r
-                       Z+=PromPiece;           /*  piece & invalidate hash */\r
+          if(b[y]-u&15)prom=b[y]-=PromPiece,   /* (under-)promotion:       */\r
+           Q-=abs(w[prom&=15])-w[p]-6*S,       /*  correct piece & score & */\r
+                       Z+=PromPiece;           /*  invalidate hash         */\r
           a->D=99;a->V=0;                      /* lock game in hash as draw*/\r
           R-=i/FAC;                            /*** total captd material ***/\r
           Fifty = t|p<3?0:Fifty+1;\r
@@ -582,7 +583,7 @@ int main(int argc, char **argv)
                             printf("move ");\r
                             printf("%c%c%c%c",'a'+(K&15),'0'+BH-(K>>4),\r
                                           'a'+(L&15),'0'+BH-(L>>4));\r
-                           if(prom)printf("%c",piecename[prom&15]+'a'-1);\r
+                           if(prom)printf("%c",piecename[prom]+'a'-1);\r
                             printf("\n");\r
 \r
                             /* time-control accounting */\r