Use '2'-bit of range field to flag hop-friend
authorH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 3 Oct 2014 08:22:51 +0000 (10:22 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Fri, 3 Oct 2014 08:30:11 +0000 (10:30 +0200)
The possibility to 'collide' from the hop platform by first stepping
back a number of squares before starting the second leg is now restricted
to one square, as indicated by the '1'-bit of the range field, for hoppers.
The '2' bit now flags that only a friendly piece can be used as platform;
an enemy counts as empty in the hop test, but because there is an actual
piece there it will terminate the ray (as no hop will reset that then).

fairymax.c

index 9b3adc7..470c03a 100644 (file)
@@ -266,14 +266,14 @@ int k,q,l,e,E,z,n;      /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/
        J=f;Z=g;\r
        if(h){h=0;goto A;}                      /* redo after doing old best*/\r
       }\r
-      s=t;v=r^flag>>12;                        /* capt & alternated vector */\r
+      s=t&&2&~rg|~t&16^k;v=r^flag>>12;         /* platform & toggled vector*/\r
       if(flag&15^4|u&32||                      /* no double or moved before*/\r
          p>2&!(flag&S)&&                       /* no P & no virgin jump,   */\r
          ((b[G=r<0?x&~15:BW-1|x&112]^32)<33    /* no virgin R in corner G, */\r
          ||b[G^1]|b[G^2]|b[FF=y+v-r])          /* no 2 empty sq. next to R */\r
         )t+=flag&4;                            /* fake capt. for nonsliding*/\r
       else if(flag&64)t=flag&128?0:t,flag&=63;else F=y; /* enable e.p.     */\r
-      if(s&&flag&8&&!(y-=rg*r,t=0)             /* hoppers go to next phase */\r
+      if(s&&flag&8&&!(y=rg&1?y-r:y,t=0)        /* hoppers go to next phase */\r
          ||!(flag&S)&&--rg<0)                  /* zig-zag piece? (w. delay)*/\r
        r=v,flag^=flag>>4&15;                   /* alternate vector & mode  */\r
      }W(!t);                                   /* if not capt. continue ray*/\r