Repair Seirawan gating
authorH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 8 Oct 2014 06:56:21 +0000 (08:56 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Wed, 8 Oct 2014 06:56:21 +0000 (08:56 +0200)
The overhaul of promotion code had forgotton to strip off the virginity
and color bits of the gated piece (gt) when assigning it to the promotion
piece type. With as a result that garbage characters were printed as
promotion suffix in gating moves.

fairymax.c

index 470c03a..5ec3380 100644 (file)
@@ -231,7 +231,7 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
         }\r
         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
+         {Q=-e-i;O=F;LL=L;prom=gt&15;\r
           if(b[y]-u&15)prom=b[y]-=PromPiece,   /* (under-)promotion:       */\r
            Q-=abs(w[prom&=15])-w[p]-(6*S>>sh), /*  correct piece & score & */\r
                        Z+=PromPiece;           /*  invalidate hash         */\r
@@ -587,6 +587,7 @@ int main(int argc, char **argv)
                             m = GetTickCount() - Ticks;\r
                             printf("# times @ %u: real=%d cpu=%1.0f\n", m + Ticks, m,\r
                                       (CPUtime() - cpuT)/CLOCKS_PER_SEC);\r
+printf("promo = %d (%c) GT = %d\n", prom, prom + '`', GT); \r
                             printf("move ");\r
                             printf("%c%c%c%c",'a'+(K&15),'0'+BH-(K>>4),\r
                                           'a'+(L&15),'0'+BH-(L>>4));\r