Fix promotion bonus
[fairymax.git] / fairymax.c
index bdb76e4..b236e4d 100644 (file)
@@ -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*/\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
-           pl[u&31]--,pl[prom&31]++,Z+=PromPiece;/*piece & invalidate hash */\r
+          if(b[y]-u&15)prom=b[y]-=PromPiece,   /* (under-)promotion:       */\r
+           Q-=abs(w[prom&=31])-w[p]-6*S,       /*  correct piece & score & */\r
+           pl[u&31]--,pl[prom]++,Z+=PromPiece; /*  count & 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