From 53922e6c4e1aec25ccd20e4e46483846c93fd775 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Mon, 13 Oct 2014 11:32:55 +0200 Subject: [PATCH] Toggle mode & direction only once on riders Rather than toggling the mode and direction every step after the range count runs out, (as needed for crooked pieces), we now only toggle when the range expires (so we can define bent riders). --- data/fmax.ini | 21 +++++++++------------ fairymax.c | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/data/fmax.ini b/data/fmax.ini index 1c28c20..4f7e297 100644 --- a/data/fmax.ini +++ b/data/fmax.ini @@ -108,8 +108,6 @@ Canvasser: C:900 1,3 16,3 -1,3 -16,3 13,7 47,7 49,7 19,7 -13,7 -47,7 -49,7 -19,7 Amazon: A:1150 1,3 16,3 15,3 17,3 -1,3 -16,3 -15,3 -17,3 14,7 31,7 33,7 18,7 -14,7 -31,7 -33,7 -18,7 -Crooked Bishop: -B:900 15,1E003 17,1E003 -15,1E003 -17,1E003 15,FFFE0003 -17,FFFE0003 -15,FFFE0003 17,FFFE0003 HOPPERS GrassHopper: @@ -210,7 +208,7 @@ In the last hexadecimal digit: 8 hop over non-empty square (normally occupied squares terminate a move) Bits set in the forelast digits TOGGLE the corresponding bits in the last digit. For hoppers when they hop over something, for the other pieces after -every step (so for normal pieces, better not set those bits!). +one to four steps (so for normal pieces, better not set those bits!). The digit before that indicates some special things; a 1 indicates the board should be treated as a cylinder, pieces crossing the right edge @@ -239,17 +237,16 @@ Useful bit combinations for the last digit are: C must hop immediately For example, if the initial step vector equals 1, and the descriptor -is 11003, the piece is an alternator (as no hop bit is set), and alternates +is 11003, the piece is a bent one (as no hop bit is set), and switches the mode from 3 to 3 (as the toggle digit is 0), i.e. all steps are moves that can both capture and non-capture, and only captures terminate the ray. -The step vector is toggled by 11, though, and thus alternates between 1 -and 10 (hex) = 16. So the piece zig-zags over the board, right, forward, right, -forward, etc. Had the move attributes been 11032, captures would only -be allowed on the odd steps (after moving right), while the even steps could -only be non-captures (both the 1 and 2 bit are toggled). With 11030 the -odd steps can only be skipped (if empty), and the even steps can both capture -and non-capture, meaning the piece moves like a Bishop that can be blocked -by a piece just next to the diagonal. +The step vector is toggled by 11, though, and thus switches from 1 +to 10 (hex) = 16. So the piece turns a 90-degree corner, from right to +forward. Had the move attributes been 11032, captures would only be +allowed before the bend (after moving right), while thereafter it can +only non-capture (both the 1 and 2 bit are toggled). With 11030 the +first step can only be skipped (if empty), and thereafter it can both capture +and non-capture. If the first step is a slider, a second step is made (if the square was empty), but if the mode toggles to leaper, the move stops there (e.g. Horse). diff --git a/fairymax.c b/fairymax.c index 007e542..2046aaa 100644 --- a/fairymax.c +++ b/fairymax.c @@ -276,7 +276,7 @@ int k,q,l,e,E,z,n; /* (q,l)=window, e=current eval. score, E=e.p. sqr.*/ )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&&!(y=rg&1?y-r:y,t=0) /* hoppers go to next phase */ - ||!(flag&S)&&--rg<0) /* zig-zag piece? (w. delay)*/ + ||!(flag&S)&&!rg--) /* 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