Fix hash-address bug
authorH.G. Muller <h.g.muller@hccnet.nl>
Mon, 11 Feb 2013 13:02:05 +0000 (14:02 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Tue, 12 Feb 2013 09:05:24 +0000 (10:05 +0100)
The lowest bit of the address was clipped off by wrong use of the mask.
Because of this only even entries could be used, and spoiling of the
key after underpromotion to the 'nearest' alternative would lead to an
enormous number of false hash hits, leading to false result claims.

fairymax.c

index 91fe48d..8b28a6c 100644 (file)
@@ -151,7 +151,7 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
 {                       /* e=score, z=prev.dest; J,Z=hashkeys; return score*/\r
  int j,r,m,v,d,h,i,F,G,P,V,f=J,g=Z,C,s,flag,FF,*ps=sp,kk=S;\r
  signed char t,p,u,x,y,X,Y,H,B,gt;\r
- struct _*a=A+(J+(k+S)*E&U-1);                 /* lookup pos. in hash table*/\r
+ struct _*a=A+(J+(k+S)*E&U);                   /* lookup pos. in hash table*/\r
  *sp++=0;\r
  q-=q<e;l-=l<=e;                               /* adj. window: delay bonus */\r
  d=a->D;m=a->V;X=a->F;Y=a->Y;                  /* resume at stored depth   */\r
@@ -747,7 +747,7 @@ int main(int argc, char **argv)
                        if(sscanf(line+7, "Ini File=%s", filename) == 1) {\r
                                inifile = filename; continue;\r
                        }\r
-                       if(sscanf(line+7, "Clear Hash") == 1) for(i=0; i<U; i++) A->K = 0;\r
+                       if(sscanf(line+7, "Clear Hash") == 1) for(i=0; i<=U; i++) A->K = 0;\r
                        if(sscanf(line+7, "MultiVariation Margin=%d", &margin) == 1) continue;\r
                        if(sscanf(line+7, "Variant fairy selects=%s", selectedFairy+6) == 1) continue;\r
                        if(sscanf(line+7, "Cambodian Makruk rules=%d", &Cambodian) == 1) continue;\r