From 3f3fc8b97c2ae601d6d437647561be4d954a4fb8 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 2 Oct 2014 23:29:08 +0200 Subject: [PATCH] Let hoppers change direction, use range bits as offset Hoppers were ignoring the step-vector toggle. This is now corrected, with a re-write to get more compact code (toggling the rights bits only in a single place). The range counter is no longer decremented for hoppers, so these bits can now be used as flag for something else. Currently they are used to subtract range*oldStep from the hop square, so that with range=1 the hop-toggle takes place on the square before the obstacle, allowing implementation of colliding bifurcators. --- fairymax.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fairymax.c b/fairymax.c index 568a08f..9b3adc7 100644 --- a/fairymax.c +++ b/fairymax.c @@ -266,15 +266,15 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ J=f;Z=g; if(h){h=0;goto A;} /* redo after doing old best*/ } - s=t;v=r^flag>>12; /* calc. alternated vector */ + s=t;v=r^flag>>12; /* capt & alternated vector */ if(flag&15^4|u&32|| /* no double or moved before*/ p>2&!(flag&S)&& /* no P & no virgin jump, */ ((b[G=r<0?x&~15:BW-1|x&112]^32)<33 /* no virgin R in corner G, */ ||b[G^1]|b[G^2]|b[FF=y+v-r]) /* no 2 empty sq. next to R */ )t+=flag&4; /* fake capt. for nonsliding*/ else if(flag&64)t=flag&128?0:t,flag&=63;else F=y; /* enable e.p. */ - if(s&&flag&8)t=0,flag^=flag>>4&15; /* hoppers go to next phase */ - if(--rg<0&!(flag&S)) /* zig-zag piece? (w. delay)*/ + if(s&&flag&8&&!(y-=rg*r,t=0) /* hoppers go to next phase */ + ||!(flag&S)&&--rg<0) /* zig-zag piece? (w. delay)*/ r=v,flag^=flag>>4&15; /* alternate vector & mode */ }W(!t); /* if not capt. continue ray*/ }} -- 1.7.0.4