Fix under-promotion hash mixup
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 3 Nov 2011 16:37:34 +0000 (17:37 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Thu, 3 Nov 2011 16:37:34 +0000 (17:37 +0100)
The hash table was invalidated on under-promotion by adding the promotion
'deficit' to the J hash key. But for some fairy-pieces (in particular
Spartan G vs W) this difference apparently caused false hits in the
null-move search, leading to misqualification of positions as stalemate.
Presumably because the J key is also modified by stm, and different
stm and promo-deficit could cancel each other. In stead we now modify
the Z hash key with the promo-deficit.

fairymax.c

index e43bd46..c68ca20 100644 (file)
@@ -222,7 +222,7 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
         {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
-                       J+=PromPiece;           /*  piece & invalidate hash */\r
+                       Z+=PromPiece;           /*  piece & 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