Please report any bugs or errors to Adam DeWitt
You may not capture your own pieces.
Use your browser's BACK button to go back to the previous page, then reload if necessary.
For general reference, here is the complete list of moves:
1. p 8l-8k 1... P 8e-8f 2. p 7l-7k 2... P 9e-9f 3. p 10l-10k 3... P 10e-10f 4. d 12k-12j 4... P 3e-3f 5. p 12l-12k 5... D 12f-12g 6. bg 11m-15i 6... RG 10d-10m; +RG-dest 7. lh 9m-10m; lh 10m-10l 7... LH 8d-10e 8. bg 15i-8b; +bg-dest 8... VG 9b-8b 9. p 8k-8j 9... P 3f-3g 10. bg 6m-11h 10... RG 7d-7m; +RG-dest 11. se 5m-7m 11... LH 10e-11g 12. bg 11h-7l 12... P 14e-14f 13. p 7k-7j 13... P 12e-12f 14. fd 10n-4h; fd 4h-3gIf this is your settings file, you may edit it at https://www.chessvariants.com/play/pbm/play.php?game=Suzumu+Shogi&settings=default&submit=Edit
Here is a code listing:
0 echo Please report any bugs or errors to Adam DeWitt 1 set mypieces () 2 set myflipped () 3 foreach label (p P d D n N i I c C s S bt BT fl FL g G de DE l L ky KY ph PH sm SM vm VM b B ss SS vs VS r R dh DH dk DK cs CS hf HF se SE ln LN bg BG rg RG wb WB fe FE lh LH vg VG gg GG fd FD k K) 4 setelem mypieces #label pieceimg #label 5 setelem myflipped #label flipimg #label 6 next 7 foreach pair ((rc rv) (RC RV) (fk q) (FK Q) (p$ +p) (P$ +P) (d$ +d) (D$ +D) (n$ +n) (N$ +N) (i$ +i) (I$ +I) (c$ +c) (C$ +C) (s$ +s) (S$ +S) (bt$ +bt) (BT$ +BT) (fl$ +fl) (FL$ +FL) (g$ +g) (G$ +G) (de$ +de) (DE$ +DE) (rc$ +rv) (RC$ +RV) (l$ +l) (L$ +L) (ky$ +ky) (KY$ +KY) (ph$ +ph) (PH$ +PH) (sm$ +sm) (SM$ +SM) (vm$ +vm) (VM$ +VM) (b$ +b) (B$ +B) (ss$ +ss) (SS$ +SS) (vs$ +vs) (VS$ +VS) (r$ +r) (R$ +R) (dh$ +dh) (DH$ +DH) (dk$ +dk) (DK$ +DK) (cs$ +cs) (CS$ +CS) (hf$ +hf) (HF$ +HF) (se$ +se) (SE$ +SE) (ln$ +ln) (LN$ +LN) (fk$ +q) (FK$ +Q) (bg$ +bg) (BG$ +BG) (rg$ +rg) (RG$ +RG) (wb$ +wb) (WB$ +WB)) 8 setelem mypieces #pair.1 pieceimg #pair.0 9 setelem myflipped #pair.1 flipimg #pair.0 10 next 11 setsystem pieces #mypieces 12 setsystem flipped #myflipped 13 setsystem originalpieces currentpieces 14 set bpieces p +p d +d n +n i +i c +c s +s bt +bt fl +fl g +g de +de rv +rv l +l ky +ky ph +ph sm +sm vm +vm b +b ss +ss vs +vs r +r dh +dh dk +dk cs +cs hf +hf se +se ln +ln q +q bg +bg rg +rg wb +wb fe lh vg gg fd k 15 set wpieces P +P D +D N +N I +I C +C S +S BT +BT FL +FL G +G DE +DE RV +RV L +L KY +KY PH +PH SM +SM VM +VM B +B SS +SS VS +VS R +R DH +DH DK +DK CS +CS HF +HF SE +SE LN +LN Q +Q BG +BG RG +RG WB +WB FE LH VG GG FD K 16 set pzs 5 17 set promote assoc p +p d +d n +n i +i c +c s +s bt +bt fl +fl g +g de +de rv +rv l +l ky +ky ph +ph sm +sm vm +vm b +b ss +ss vs +vs r +r dh +dh dk +dk cs +cs hf +hf se +se ln +ln q +q bg +bg rg +rg wb +wb fe fe lh lh vg vg gg gg fd fd k k P +P D +D N +N I +I C +C S +S BT +BT FL +FL G +G DE +DE RV +RV L +L KY +KY PH +PH SM +SM VM +VM B +B SS +SS VS +VS R +R DH +DH DK +DK CS +CS HF +HF SE +SE LN +LN Q +Q BG +BG RG +RG WB +WB FE FE LH LH VG VG GG GG FD FD K K 18 set steps array 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 19 setsystem maxmove 3 20 ban commands allmoves 21 allow moves 1 captures 1 moves 2 captures 2 pass 2 promotions 2 promotions 3 22 map n 0 1 23 map n2 0 2 24 map s 0 -1 25 map s2 0 -2 26 map e 1 0 27 map e2 2 0 28 map w -1 0 29 map w2 -2 0 30 map ne 1 1 31 map ne2 2 2 32 map se 1 -1 33 map se2 2 -2 34 map sw -1 -1 35 map sw2 -2 -2 36 map nw -1 1 37 map nw2 -2 2 38 def NO logride #0 #1 (n2 n n n n n n n n n n n n n) 39 def NE logride #0 #1 (ne2 ne ne ne ne ne ne ne ne ne ne ne ne ne) 40 def EA logride #0 #1 (e2 e) 41 def SED logride #0 #1 (se2 se se se se se se se se se se se se se) 42 def SO logride #0 #1 (s2 s s s s s s s s s s s s s) 43 def SW logride #0 #1 (sw2 sw sw sw sw sw sw sw sw sw sw sw sw sw) 44 def WE logride #0 #1 (w2 w) 45 def NW logride #0 #1 (nw2 nw nw nw nw nw nw nw nw nw nw nw nw nw) 46 def p checkaleap #0 #1 0 1 47 def P checkaleap #0 #1 0 -1 48 def pL array where #0 0 1 49 def PL array where #0 0 -1 50 def d checkaleap #0 #1 0 1 or checkaleap #0 #1 -1 -1 or checkaleap #0 #1 1 -1 51 def D checkaleap #0 #1 0 -1 or checkaleap #0 #1 -1 1 or checkaleap #0 #1 1 1 52 def dL array where #0 0 1 where #0 -1 -1 where #0 1 -1 53 def DL array where #0 0 -1 where #0 -1 1 where #0 1 1 54 def n checkleap #0 #1 1 2 55 copyfn n N 56 def nL leaps #0 1 2 57 def NL leaps #0 1 2 58 copyfn D i 59 copyfn d I 60 def iL array where #0 0 -1 where #0 -1 1 where #0 1 1 61 def IL array where #0 0 1 where #0 -1 -1 where #0 1 -1 62 def c fn i #0 #1 or fn p #0 #1 63 def C fn I #0 #1 or fn P #0 #1 64 def cL array where #0 0 1 where #0 0 -1 where #0 -1 1 where #0 1 1 65 def CL array where #0 0 1 where #0 0 -1 where #0 -1 -1 where #0 1 -1 66 def s checkleap #0 #1 1 1 or fn p #0 #1 67 def S checkleap #0 #1 1 1 or fn P #0 #1 68 def sL merge leaps #0 1 1 array where #0 0 1 69 def SL merge leaps #0 1 1 array where #0 0 -1 70 def bt fn S #0 #1 or checkaleap #0 #1 -1 0 or checkaleap #0 #1 1 0 71 def BT fn s #0 #1 or checkaleap #0 #1 -1 0 or checkaleap #0 #1 1 0 72 def btL merge leaps #0 1 1 array where #0 -1 0 where #0 1 0 where #0 0 -1 73 def BTL merge leaps #0 1 1 array where #0 -1 0 where #0 1 0 where #0 0 1 74 def fl checkleap #0 #1 1 1 or checkaleap #0 #1 0 1 or checkaleap #0 #1 0 -1 75 copyfn fl FL 76 def flL merge leaps #0 1 1 array where #0 0 1 where #0 0 -1 77 def FLL merge leaps #0 1 1 array where #0 0 1 where #0 0 -1 78 def g checkleap #0 #1 0 1 or checkaleap #0 #1 -1 1 or checkaleap #0 #1 1 1 79 def G checkleap #0 #1 0 1 or checkaleap #0 #1 -1 -1 or checkaleap #0 #1 1 -1 80 def gL merge leaps #0 0 1 array where #0 -1 1 where #0 1 1 81 def GL merge leaps #0 0 1 array where #0 -1 -1 where #0 1 -1 82 def de fn BT #0 #1 83 def DE fn bt #0 #1 84 def deL merge leaps #0 1 1 array where #0 -1 0 where #0 1 0 where #0 0 1 85 def DEL merge leaps #0 1 1 array where #0 -1 0 where #0 1 0 where #0 0 -1 86 def rv checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 87 copyfn rv RV 88 def rvL rays #0 0 1 89 def RVL rays #0 0 1 90 def l checkaride #0 #1 0 -1 and <= distance #0 #1 2 or checkaride #0 #1 0 1 91 def L checkaride #0 #1 0 1 and <= distance #0 #1 2 or checkaride #0 #1 0 -1 92 def lL rays #0 0 1 93 def LL rays #0 0 1 94 def ky checkleap #0 #1 1 1 or checkleap #0 #1 0 2 95 copyfn ky KY 96 def kyL merge leaps #0 1 1 leaps #0 0 2 97 def KYL merge leaps #0 1 1 leaps #0 0 2 98 def ph checkleap #0 #1 0 1 or checkleap #0 #1 2 2 99 copyfn ph PH 100 def phL merge leaps #0 0 1 leaps #0 2 2 101 def PHL merge leaps #0 0 1 leaps #0 2 2 102 def sm checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkleap #0 #1 0 1 103 copyfn sm SM 104 def smL rays #0 0 1 105 def SML rays #0 0 1 106 def vm checkaride #0 #1 0 -1 or checkaride #0 #1 0 1 or checkleap #0 #1 0 1 107 copyfn vm VM 108 def vmL rays #0 0 1 109 def VML rays #0 0 1 110 def b checkride #0 #1 1 1 111 def B checkride #0 #1 1 1 112 def bL rays #0 1 1 113 def BL rays #0 1 1 114 def ss checkaride #0 #1 0 1 and <= distance #0 #1 2 or checkleap #0 #1 0 1 or checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 115 def SS checkaride #0 #1 0 -1 and <= distance #0 #1 2 or checkleap #0 #1 0 1 or checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 116 def ssL rays #0 0 1 117 def SSL rays #0 0 1 118 def vs checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 and <= distance #0 #1 2 or checkleap #0 #1 0 1 or checkaride #0 #1 0 1 119 def VS checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 and <= distance #0 #1 2 or checkleap #0 #1 0 1 or checkaride #0 #1 0 -1 120 def vsL rays #0 0 1 121 def VSL rays #0 0 1 122 def r checkride #0 #1 0 1 123 def R checkride #0 #1 0 1 124 def rL rays #0 0 1 125 def RL rays #0 0 1 126 def dh fn b #0 #1 or checkleap #0 #1 0 1 127 def DH fn B #0 #1 or checkleap #0 #1 0 1 128 def dhL merge rays #0 1 1 leaps #0 0 1 129 def DHL merge rays #0 1 1 leaps #0 0 1 130 def dk fn r #0 #1 or checkleap #0 #1 1 1 131 def DK fn R #0 #1 or checkleap #0 #1 1 1 132 def dkL merge rays #0 0 1 leaps #0 1 1 133 def DKL merge rays #0 0 1 leaps #0 1 1 134 def cs checkride #0 #1 0 1 and <= distance #0 #1 2 or checkride #0 #1 1 1 or checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 135 def CS checkride #0 #1 0 1 and <= distance #0 #1 2 or checkride #0 #1 1 1 or checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 136 def csL merge rays #0 0 1 rays #0 1 1 137 def CSL merge rays #0 0 1 rays #0 1 1 138 def hf cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkaride #0 #1 0 -1 or checkleap #0 #1 0 1 or checkaleap #0 #1 0 2) (checkaleap #0 #1 0 1 or checkaleap #0 #1 0 -1) and #0 and #1 139 def HF cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkaride #0 #1 0 1 or checkleap #0 #1 0 1 or checkaleap #0 #1 0 -2) (checkaleap #0 #1 0 1 or checkaleap #0 #1 0 -1) and #0 and #1 140 def hfL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 141 def HFL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 142 def se cond var firstpart (checkride #0 #1 0 1 or checkaride #0 #1 -1 -1 or checkaride #0 #1 1 -1 or checkleap #0 #1 1 1 or checkaleap #0 #1 -2 2 or checkaleap #0 #1 2 2) (sub SE #0 #1) and #0 and #1 143 def SE cond var firstpart (checkride #0 #1 0 1 or checkaride #0 #1 -1 1 or checkaride #0 #1 1 1 or checkleap #0 #1 1 1 or checkaleap #0 #1 -2 -2 or checkaleap #0 #1 2 -2) (sub SE #0 #1) and #0 and #1 144 def seL mergeall rays #0 0 1 rays #0 1 1 leaps #0 2 2 145 def SEL mergeall rays #0 0 1 rays #0 1 1 leaps #0 2 2 146 def ln <= distance #0 #1 cond var firstpart 2 1 147 copyfn ln LN 148 def lnL mergeall leaps #0 0 1 leaps #0 1 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 149 def LNL mergeall leaps #0 0 1 leaps #0 1 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 150 def q fn r #0 #1 or fn b #0 #1 151 def Q fn R #0 #1 or fn B #0 #1 152 def qL merge rays #0 0 1 rays #0 1 1 153 def QL merge rays #0 0 1 rays #0 1 1 154 def bg sub BG #0 #1 and cond empty #0 capture (not empty #1) or checkride #0 #1 1 1 155 copyfn bg BG 156 def bgL rays #0 1 1 157 def BGL rays #0 1 1 158 def rg sub RG #0 #1 and cond empty #0 capture (not empty #1) or checkride #0 #1 0 1 159 copyfn rg RG 160 def rgL rays #0 0 1 161 def RGL rays #0 0 1 162 def wb checkride #0 #1 0 1 and <= distance #0 #1 2 or checkride #0 #1 1 1 or checkaride #0 #1 1 0 or checkaride #0 #1 -1 0 163 copyfn wb WB 164 def wbL merge rays #0 0 1 rays #0 1 1 165 def WBL merge rays #0 0 1 rays #0 1 1 166 def fe cond var firstpart (fn q #0 #1 or checkleap #0 #1 0 2 or checkleap #0 #1 2 2) (checkleap #0 #1 1 1) and #0 and #1 167 copyfn fe FE 168 def feL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 leaps #0 2 2 169 def FEL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 leaps #0 2 2 170 def lh cond var firstpart (<= distance #0 #1 2 or fn b #0 #1) (checkleap #0 #1 0 1 or checkleap #0 #1 1 1) and #0 and #1 171 copyfn lh LH 172 def lhL mergeall rays #0 1 1 leaps #0 0 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 173 def LHL mergeall rays #0 1 1 leaps #0 0 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 174 def vg cond var firstpart (sub BG #0 #1 and cond empty #0 capture (not empty #1) or checkride #0 #1 1 1 or checkmaxsteps #0 #1 3) (checkleap #0 #1 0 1 or checkleap #0 #1 1 1 and == var ori #1) and #0 and #1 175 copyfn vg VG 176 def vgL mergeall rays #0 1 1 leaps #0 0 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 leaps #0 0 3 leaps #0 1 3 leaps #0 2 3 leaps #0 3 3 177 def VGL mergeall rays #0 1 1 leaps #0 0 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 leaps #0 0 3 leaps #0 1 3 leaps #0 2 3 leaps #0 3 3 178 def gg sub GG #0 #1 and cond empty #0 capture (not empty #1) or checkride #0 #1 0 1 or checkride #0 #1 1 1 179 copyfn gg GG 180 def ggL merge rays #0 0 1 rays #0 1 1 181 def GGL merge rays #0 0 1 rays #0 1 1 182 def fd cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3) (sub FD #0 #1 and not match space #1 FD +WB +CS) and #0 and #1 183 def FD cond var firstpart (checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 or checkmaxsteps #0 #1 3) (sub FD #0 #1 and not match space #1 fd +wb +cs) and #0 and #1 184 def fdL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 leaps #0 0 3 leaps #0 1 3 leaps #0 2 3 leaps #0 3 3 185 def FDL mergeall rays #0 0 1 rays #0 1 1 leaps #0 0 2 leaps #0 1 2 leaps #0 2 2 leaps #0 0 3 leaps #0 1 3 leaps #0 2 3 leaps #0 3 3 186 copyfn g +p 187 copyfn G +P 188 copyfn gL +pL 189 copyfn GL +PL 190 def +d checkaride #0 #1 0 1 or checkaride #0 #1 -1 -1 or checkaride #0 #1 1 -1 191 def +D checkaride #0 #1 0 -1 or checkaride #0 #1 -1 1 or checkaride #0 #1 1 1 192 def +dL mergeall ray #0 0 1 ray #0 -1 -1 ray #0 1 -1 193 def +DL mergeall ray #0 0 -1 ray #0 -1 1 ray #0 1 1 194 copyfn ss +n 195 copyfn SS +N 196 copyfn ssL +nL 197 copyfn SSL +NL 198 copyfn vs +i 199 copyfn VS +I 200 copyfn vsL +iL 201 copyfn VSL +IL 202 copyfn sm +c 203 copyfn SM +C 204 copyfn smL +cL 205 copyfn SML +CL 206 copyfn vm +s 207 copyfn VM +S 208 copyfn vmL +sL 209 copyfn VML +SL 210 def +bt checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 or checkleap #0 #1 0 1 or checkleap #0 #1 1 1 211 copyfn +bt +BT 212 def +btL mergeall ray #0 0 1 ray #0 0 -1 leaps #0 0 1 leaps #0 1 1 213 def +BTL mergeall ray #0 0 1 ray #0 0 -1 leaps #0 0 1 leaps #0 1 1 214 copyfn b +fl 215 copyfn B +FL 216 copyfn bL +flL 217 copyfn BL +FLL 218 copyfn r +g 219 copyfn R +G 220 copyfn rL +gL 221 copyfn RL +GL 222 def +de checkleap #0 #1 0 1 or checkleap #0 #1 1 1 223 copyfn +de +DE 224 def +deL merge leaps #0 0 1 leaps #0 1 1 225 def +DEL merge leaps #0 0 1 leaps #0 1 1 226 def +rv checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 or checkaride #0 #1 -1 -1 or checkaride #0 #1 1 -1 227 def +RV checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 or checkaride #0 #1 -1 1 or checkaride #0 #1 1 1 228 def +rvL mergeall ray #0 0 1 ray #0 0 -1 ray #0 -1 -1 ray #0 1 -1 229 def +RVL mergeall ray #0 0 1 ray #0 0 -1 ray #0 -1 1 ray #0 1 1 230 def +l checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 or checkaride #0 #1 -1 1 or checkaride #0 #1 1 1 231 def +L checkaride #0 #1 0 1 or checkaride #0 #1 0 -1 or checkaride #0 #1 -1 -1 or checkaride #0 #1 1 -1 232 def +lL mergeall ray #0 0 1 ray #0 0 -1 ray #0 -1 1 ray #0 1 1 233 def +LL mergeall ray #0 0 1 ray #0 0 -1 ray #0 -1 -1 ray #0 1 -1 234 copyfn ln +ky 235 copyfn LN +KY 236 copyfn lnL +kyL 237 copyfn LNL +KYL 238 copyfn q +ph 239 copyfn Q +PH 240 copyfn qL +phL 241 copyfn QL +PHL 242 def +sm checkride #0 #1 1 1 or checkaride #0 #1 -1 0 or checkaride #0 #1 1 0 243 copyfn +sm +SM 244 def +sm$L merge rays #0 0 1 rays #0 1 1 245 def +SML merge rays #0 0 1 rays #0 1 1 246 def +vm checkride #0 #1 1 1 or checkaride #0 #1 0 -1 or checkaride #0 #1 0 1 247 copyfn +vm +VM 248 def +vmL merge rays #0 0 1 rays #0 1 1 249 def +VML merge rays #0 0 1 rays #0 1 1 250 copyfn dh +b 251 copyfn DH +B 252 copyfn dhL +bL 253 copyfn DHL +BL 254 copyfn wb +ss 255 copyfn WB +SS 256 copyfn wbL +ssL 257 copyfn WBL +SSL 258 copyfn cs +vs 259 copyfn CS +VS 260 copyfn csL +vsL 261 copyfn CSL +VSL 262 copyfn dk +r 263 copyfn DK +R 264 copyfn dkL +rL 265 copyfn DKL +RL 266 copyfn hf +dh 267 copyfn HF +DH 268 copyfn hfL +dhL 269 copyfn HFL +DHL 270 copyfn se +dk 271 copyfn SE +DK 272 copyfn seL +dkL 273 copyfn SEL +DKL 274 def +cs cond var firstpart (checkleap #0 #1 0 1 or checkleap #0 #1 1 1 and cond empty #0 capture (not empty #1) or fn NO #0 #1 or fn NE #0 #1 or fn EA #0 #1 or fn SED #0 #1 or fn SO #0 #1 or fn SW #0 #1 or fn WE #0 #1 or fn NW #0 #1) (sub FD #0 #1 and not match space #1 FD +WB +CS) and #0 and #1 275 def +CS cond var firstpart (checkleap #0 #1 0 1 or checkleap #0 #1 1 1 and cond empty #0 capture (not empty #1) or fn NO #0 #1 or fn NE #0 #1 or fn EA #0 #1 or fn SED #0 #1 or fn SO #0 #1 or fn SW #0 #1 or fn WE #0 #1 or fn NW #0 #1) (sub FD #0 #1 and not match space #1 fd +wb +cs) and #0 and #1 276 def +csL mergeall leaps #0 0 1 leaps #0 1 1 lograys #0 (n2 n) (ne2 ne) (e2 e stop) (se2 se) (s2 s) (sw2 sw) (w2 w stop) (nw2 nw) 277 def +CSL mergeall leaps #0 0 1 leaps #0 1 1 lograys #0 (n2 n) (ne2 ne) (e2 e stop) (se2 se) (s2 s) (sw2 sw) (w2 w stop) (nw2 nw) 278 copyfn bg +hf 279 copyfn BG +HF 280 copyfn bgL +hfL 281 copyfn BGL +HFL 282 copyfn rg +se 283 copyfn RG +SE 284 copyfn rgL +seL 285 copyfn RGL +SEL 286 copyfn lh +ln 287 copyfn LH +LN 288 copyfn lhL +lnL 289 copyfn LHL +LNL 290 copyfn fe +q 291 copyfn FE +Q 292 copyfn feL +qL 293 copyfn FEL +QL 294 copyfn vg +bg 295 copyfn VG +BG 296 copyfn vgL +bgL 297 copyfn VGL +BGL 298 copyfn gg +rg 299 copyfn GG +RG 300 copyfn ggL +rgL 301 copyfn GGL +RGL 302 copyfn fd +wb 303 copyfn FD +WB 304 copyfn fdL +wbL 305 copyfn FDL +WBL 306 def k checkleap #0 #1 0 1 or checkleap #0 #1 1 1 307 copyfn k K 308 def kL merge leaps #0 0 1 leaps #0 1 1 309 def KL merge leaps #0 0 1 leaps #0 1 1 310 sub FD from to 311 return cond cond empty #from capture (not empty #to) (checkleap #from #to 0 1 or checkleap #from #to 1 1) (checkleap #from #to 0 1 or checkleap #from #to 1 1 and == var ori #to) and #to 312 endsub 313 sub GG from to 314 local step, cnt, i 315 if != file #from file #to and != rank #from rank #to and != abs - file #from file #to abs - rank #from rank #to 316 return false 317 endif 318 set step #from 319 set cnt 0 320 do 321 for i #steps 322 set step where #step cmp file #to file #from cmp rank #to rank #from 323 if == #step #to 324 return true 325 endif 326 if != @ space #step 327 set cnt inc #cnt 328 endif 329 if >= #cnt 3 330 return false 331 endif 332 next 333 loop never 334 endsub 335 sub RG from to 336 local step, cnt, i 337 if != file #from file #to and != rank #from rank #to 338 return false 339 endif 340 set step #from 341 set cnt 0 342 do 343 for i #steps 344 set step where #step cmp file #to file #from cmp rank #to rank #from 345 if == #step #to 346 return true 347 endif 348 if != @ space #step 349 set cnt inc #cnt 350 endif 351 if >= #cnt 3 352 return false 353 endif 354 next 355 loop never 356 endsub 357 sub BG from to 358 local step, cnt, i 359 if != abs - file #from file #to abs - rank #from rank #to 360 return false 361 endif 362 set step #from 363 set cnt 0 364 do 365 for i #steps 366 set step where #step cmp file #to file #from cmp rank #to rank #from 367 if == #step #to 368 return true 369 endif 370 if != @ space #step 371 set cnt inc #cnt 372 endif 373 if >= #cnt 3 374 return false 375 endif 376 next 377 loop never 378 endsub 379 sub SE from to 380 if > slope origin dest 0 381 return checkaleap #from #to 1 1 or checkaleap #from #to -1 -1 382 else 383 return checkaleap #from #to 1 -1 or checkaleap #from #to -1 1 384 endif 385 endsub 386 sub stalemated kingpos 387 store 388 local from piece to 389 if isupper #kingpos 390 def friends intersection nolower #wpieces 391 def friend match #0 #wpieces 392 else 393 def friends intersection noupper #bpieces 394 def friend match #0 #bpieces 395 endif 396 set firstpart true 397 store 398 for (from piece) fn friends 399 for to fn join #piece L #from 400 if fn #piece #from #to and not fn friend space #to and onboard #to 401 move #from #to 402 setlegal #from #to 403 endif 404 restore 405 next 406 next 407 return cond count system legalmoves false true 408 endsub 409 sub legalmoves2 kingpos 410 store 411 local from piece to 412 if isupper #kingpos 413 def friends intersection nolower #wpieces 414 def friend match #0 #wpieces 415 else 416 def friends intersection noupper #bpieces 417 def friend match #0 #bpieces 418 endif 419 set firstpart false 420 set oldto dest 421 store 422 for (from piece) fn friends 423 if == #from #oldto 424 for to fn join #piece L #from 425 if fn #piece #from #to and not fn friend space #to and onboard #to 426 move #from #to 427 setlegal #from #to 428 endif 429 restore 430 next 431 endif 432 next 433 return cond count system legalmoves false true 434 endsub 435 sub isdoublemove from to 436 verify var firstpart 437 if match moved fd +wb and sub canburn #from #to king 438 return true 439 elseif match moved FD +WB and sub canburn #from #to KING 440 return true 441 elseif match moved +cs and fn +cs #from #to and >= distance #from #to 2 and sub canburn #from #to king 442 return true 443 elseif match moved +CS and fn +CS #from #to and >= distance #from #to 2 and sub canburn #from #to KING 444 return true 445 elseif checkleap #from #to 0 1 or checkleap #from #to 1 1 and match moved ln LN lh LH vg VG +ky +KY +ln +LN +bg +BG and var firstpart 446 if match moved vg VG +bg +BG and capture 447 return false 448 else 449 return true 450 endif 451 elseif checkleap #from #to 1 1 and match moved fe FE +q +Q 452 return true 453 elseif checkaleap #from #to 0 1 and match moved hf +dh 454 return true 455 elseif checkaleap #from #to 0 -1 and match moved HF +DH 456 return true 457 elseif checkaleap #from #to -1 1 or checkaleap #from #to 1 1 and match moved se +dk 458 return true 459 elseif checkaleap #from #to -1 -1 or checkaleap #from #to 1 -1 and match moved SE +DK 460 return true 461 else 462 return false 463 endif 464 endsub 465 sub canburn from to kingpos 466 if fn K #from #to 467 return true 468 else 469 if isupper #kingpos 470 def enemy match #0 #bpieces and not match #0 fd +wb +cs 471 else 472 def enemy match #0 #wpieces and not match #0 FD +WB +CS 473 endif 474 set north where #to 0 1 475 set east where #to 1 0 476 set south where #to 0 -1 477 set west where #to -1 0 478 set northeast where #to 1 1 479 set southeast where #to 1 -1 480 set southwest where #to -1 -1 481 set northwest where #to -1 1 482 if fn enemy space #north 483 return true 484 elseif fn enemy space #northeast 485 return true 486 elseif fn enemy space #east 487 return true 488 elseif fn enemy space #southeast 489 return true 490 elseif fn enemy space #south 491 return true 492 elseif fn enemy space #southwest 493 return true 494 elseif fn enemy space #west 495 return true 496 elseif fn enemy space #northwest 497 return true 498 else 499 return false 500 endif 501 endif 502 endsub 503 sub bpromotion from to 504 verify not sub isdoublemove origin dest 505 if onboard where #from 0 #pzs and onboard where #to 0 #pzs 506 return false 507 elseif not match moved p d n i c s bt fl g de rv l ky ph sm vm b ss vs r dh dk cs hf se ln q bg rg wb 508 return false 509 else 510 return true 511 endif 512 endsub 513 sub wpromotion from to 514 verify not sub isdoublemove origin dest 515 if onboard where #from 0 neg #pzs and onboard where #to 0 neg #pzs 516 return false 517 elseif not match moved P D N I C S BT FL G DE RV L KY PH SM VM B SS VS R DH DK CS HF SE LN Q BG RG WB 518 return false 519 else 520 return true 521 endif 522 endsub 523 sub bpromote from to 524 set legal false 525 verify fn moved origin dest 526 if match moved fd +wb +cs and match old FD +WB +CS and not var firstpart 527 die "Fire Demons and Heavenly Tetrarches cannot be burned." 528 elseif != space #to moved and sub isdoublemove origin dest 529 die "You may not promote any piece without completing your move." 530 elseif != space #to moved and onboard where #from 0 #pzs and onboard where #to 0 #pzs 531 die "You may not promote any piece without entering or exiting the promotion zone." 532 elseif not onboard where #from 0 #pzs or not onboard where #to 0 #pzs 533 if == moved space #to and not fnmatch *-dest* thismove and match moved p d n i c s bt fl g de rv l ky ph sm vm b ss vs r dh dk cs hf se ln q bg rg wb and not sub isdoublemove origin dest 534 set pc moved 535 set pm elem moved promote 536 askpromote #pm #pc 537 elseif != moved space dest and != elem moved promote space dest 538 set np space #to 539 die "You may not promote a" moved "to a" #np 540 endif 541 endif 542 set legal true 543 return true 544 endsub 545 sub wpromote from to 546 set legal false 547 verify fn moved origin dest 548 if match moved FD +WB +CS and match old fd +wb +cs and not var firstpart 549 die "Fire Demons and Heavenly Tetrarches cannot be burned." 550 elseif != space #to moved and sub isdoublemove origin dest 551 die "You may not promote any piece without completing your move." 552 elseif != space #to moved and onboard where #from 0 neg #pzs and onboard where #to 0 neg #pzs 553 die "You may not promote any piece without entering or exiting the promotion zone." 554 elseif not onboard where #from 0 neg #pzs or not onboard where #to 0 neg #pzs 555 if == moved space #to and not fnmatch *-dest* thismove and match moved P D N I C S BT FL G DE RV L KY PH SM VM B SS VS R DH DK CS HF SE LN Q BG RG WB and not sub isdoublemove origin dest 556 set pc moved 557 set pm elem moved promote 558 askpromote #pm #pc 559 elseif != moved space dest and != elem moved promote space dest 560 set np space #to 561 die "You may not promote a" moved "to a" #np 562 endif 563 endif 564 set legal true 565 return true 566 endsub 567 sub preauto1 568 store 569 endsub 570 sub preauto2 571 store 572 endsub 573 sub postauto1 574 set mvs explode chr 59 thismove 575 restore 576 set i 0 577 set firstpart true 578 set firstcapture false 579 eval join "MOVE: " trim elem var i mvs 580 if match old #bpieces 581 die You may not capture your own pieces. 582 endif 583 set ori origin 584 set dst dest 585 if not sub isdoublemove origin dest and sub bpromotion #ori dest 586 inc i 587 if < var i count var mvs 588 set ori2 origin 589 set dst2 dest 590 eval join "MOVE: " trim elem var i mvs 591 if != var dst2 dest or != var ori2 origin or == pass trim elem var i mvs 592 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 593 endif 594 endif 595 endif 596 set legal false 597 switch moved 598 case p +p d +d n +n i +i c +c s +s bt +bt fl +fl g +g de +de rv +rv l +l ky +ky ph +ph sm +sm vm +vm b +b ss +ss vs +vs r +r dh +dh dk +dk cs +cs hf +hf se +se ln +ln q +q bg +bg rg +rg wb +wb fe lh vg gg fd k 599 gosub bpromote #ori dest 600 break 601 default 602 die You may not move a moved 603 endswitch 604 if not var legal 605 die You may not move a moved from origin to dest 606 elseif match moved +cs and fn k origin dest 607 empty dest 608 add moved origin 609 endif 610 if capture 611 set firstcapture true 612 endif 613 if var firstpart and sub isdoublemove origin dest 614 inc i 615 do while < var i count var mvs 616 set firstpart false 617 set mv trim elem var i mvs 618 if == var mv pass 619 if not sub isdoublemove origin dest and sub bpromotion #ori dest 620 inc i 621 if < var i count var mvs 622 set ori2 origin 623 set dst2 dest 624 eval join "MOVE: " trim elem var i mvs 625 if != var dst2 dest or != var ori2 origin 626 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 627 endif 628 endif 629 endif 630 gosub bpromote #ori dest 631 break 632 endif 633 eval join "MOVE: " var mv 634 if match old #bpieces 635 die You may not capture your own pieces. 636 elseif != var dst origin 637 die You may not move more than one piece per turn. 638 endif 639 if not sub isdoublemove origin dest and sub bpromotion #ori dest 640 inc i 641 if < var i count var mvs 642 set ori2 origin 643 set dst2 dest 644 eval join "MOVE: " trim elem var i mvs 645 if != var dst2 dest or != var ori2 origin 646 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 647 endif 648 endif 649 endif 650 set legal false 651 switch moved 652 case hf +dh se +dk ln +ky fe +q lh +ln vg +bg fd +wb +cs 653 gosub bpromote #ori dest 654 break 655 default 656 die You may not move a moved 657 endswitch 658 if not var legal 659 die You may not move a moved from origin to dest 660 elseif match moved fd +wb +cs and fn k origin dest and capture 661 empty dest 662 add moved origin 663 endif 664 loop never 665 endif 666 if != #ori dest 667 set bskips 0 668 elseif != space dest moved 669 set bskips 0 670 elseif var firstcapture 671 set bskips 0 672 else 673 inc bskips 674 endif 675 inc i 676 if < var i count var mvs 677 die Too many moves. 678 endif 679 set posvar join "b" join fencode boardflags 680 inc #posvar 681 endsub 682 sub postauto2 683 set mvs explode chr 59 thismove 684 restore 685 set i 0 686 set firstpart true 687 set firstcapture false 688 eval join "MOVE: " trim elem var i mvs 689 if match old #wpieces 690 die You may not capture your own pieces. 691 endif 692 set ori origin 693 set dst dest 694 if not sub isdoublemove origin dest and sub wpromotion #ori dest 695 inc i 696 if < var i count var mvs 697 set ori2 origin 698 set dst2 dest 699 eval join "MOVE: " trim elem var i mvs 700 if != var dst2 dest or != var ori2 origin or == pass trim elem var i mvs 701 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 702 endif 703 endif 704 endif 705 set legal false 706 switch moved 707 case P +P D +D N +N I +I C +C S +S BT +BT FL +FL G +G DE +DE RV +RV L +L KY +KY PH +PH SM +SM VM +VM B +B SS +SS VS +VS R +R DH +DH DK +DK CS +CS HF +HF SE +SE LN +LN Q +Q BG +BG RG +RG WB +WB FE LH VG GG FD K 708 gosub wpromote #ori dest 709 break 710 default 711 die You may not move a moved 712 endswitch 713 if not var legal 714 die You may not move a moved from origin to dest 715 elseif match moved +CS and fn K origin dest 716 empty dest 717 add moved origin 718 endif 719 if capture 720 set firstcapture true 721 endif 722 if var firstpart and sub isdoublemove origin dest 723 inc i 724 do while < var i count var mvs 725 set firstpart false 726 set mv trim elem var i mvs 727 if == var mv pass 728 if not sub isdoublemove origin dest and sub wpromotion #ori dest 729 inc i 730 if < var i count var mvs 731 set ori2 origin 732 set dst2 dest 733 eval join "MOVE: " trim elem var i mvs 734 if != var dst2 dest or != var ori2 origin 735 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 736 endif 737 endif 738 endif 739 gosub wpromote #ori dest 740 break 741 endif 742 eval join "MOVE: " var mv 743 if match old #wpieces 744 die You may not capture your own pieces. 745 elseif != var dst origin 746 die You may not move more than one piece per turn. 747 endif 748 if not sub isdoublemove origin dest and sub wpromotion #ori dest 749 inc i 750 if < var i count var mvs 751 set ori2 origin 752 set dst2 dest 753 eval join "MOVE: " trim elem var i mvs 754 if != var dst2 dest or != var ori2 origin 755 die Only a promotion can immediately follow a promotable piece moving to or from the promotion zone. 756 endif 757 endif 758 endif 759 set legal false 760 switch moved 761 case HF +DH SE +DK LN +KY FE +Q LH +LN VG +BG FD +WB +CS 762 gosub wpromote #ori dest 763 break 764 default 765 die You may not move a moved 766 endswitch 767 if not var legal 768 die You may not move a moved from origin to dest 769 elseif match moved FD +WB +CS and fn K origin dest and capture 770 empty dest 771 add moved origin 772 endif 773 loop never 774 endif 775 if != #ori dest 776 set wskips 0 777 elseif != space dest moved 778 set wskips 0 779 elseif var firstcapture 780 set wskips 0 781 else 782 inc wskips 783 endif 784 inc i 785 if < var i count var mvs 786 die Too many moves. 787 endif 788 set posvar join "w" join fencode boardflags 789 inc #posvar 790 endsub 791 preauto1 792 moveindex 1 793 MOVE: p 8l-8k 794 postauto1 795 preauto2 796 moveindex 2 797 MOVE: P 8e-8f 798 postauto2 799 preauto1 800 moveindex 3 801 MOVE: p 7l-7k 802 postauto1 803 preauto2 804 moveindex 4 805 MOVE: P 9e-9f 806 postauto2 807 preauto1 808 moveindex 5 809 MOVE: p 10l-10k 810 postauto1 811 preauto2 812 moveindex 6 813 MOVE: P 10e-10f 814 postauto2 815 preauto1 816 moveindex 7 817 MOVE: d 12k-12j 818 postauto1 819 preauto2 820 moveindex 8 821 MOVE: P 3e-3f 822 postauto2 823 preauto1 824 moveindex 9 825 MOVE: p 12l-12k 826 postauto1 827 preauto2 828 moveindex 10 829 MOVE: D 12f-12g 830 postauto2 831 preauto1 832 moveindex 11 833 MOVE: bg 11m-15i 834 postauto1 835 preauto2 836 moveindex 12 837 MOVE: RG 10d-10m 838 MOVE: +RG-dest 839 postauto2 840 preauto1 841 moveindex 13 842 MOVE: lh 9m-10m 843 MOVE: lh 10m-10l 844 postauto1 845 preauto2 846 moveindex 14 847 MOVE: LH 8d-10e 848 postauto2 849 preauto1 850 moveindex 15 851 MOVE: bg 15i-8b 852 MOVE: +bg-dest 853 postauto1 854 preauto2 855 moveindex 16 856 MOVE: VG 9b-8b 857 postauto2 858 preauto1 859 moveindex 17 860 MOVE: p 8k-8j 861 postauto1 862 preauto2 863 moveindex 18 864 MOVE: P 3f-3g 865 postauto2 866 preauto1 867 moveindex 19 868 MOVE: bg 6m-11h 869 postauto1 870 preauto2 871 moveindex 20 872 MOVE: RG 7d-7m 873 MOVE: +RG-dest 874 postauto2 875 preauto1 876 moveindex 21 877 MOVE: se 5m-7m 878 postauto1 879 preauto2 880 moveindex 22 881 MOVE: LH 10e-11g 882 postauto2 883 preauto1 884 moveindex 23 885 MOVE: bg 11h-7l 886 postauto1 887 preauto2 888 moveindex 24 889 MOVE: P 14e-14f 890 postauto2 891 preauto1 892 moveindex 25 893 MOVE: p 7k-7j 894 postauto1 895 preauto2 896 moveindex 26 897 MOVE: P 12e-12f 898 postauto2 899 preauto1 900 moveindex 27 901 MOVE: fd 10n-4h 902 MOVE: fd 4h-3g 903 postauto1 904 preauto2 905 if >= #bskips 1 and >= #wskips 1 906 die You may not skip a turn when the immediately preceding turn was skipped by the opponent. 907 endif 908 if not findpiece K spaces and not findpiece +DE spaces 909 say All Royals Captured! Black has won! 910 won 911 endif 912 set posvar join "b" join fencode boardflags 913 if >= var #posvar 4 and < #bskips 2 914 say Four Times Repetition! Drawn Game! 915 drawn 916 endif 917 if var firstpart and sub isdoublemove origin dest and match moved hf +dh se +dk ln +ky fe +q lh +ln vg +bg fd +wb +cs 918 remind "Enter second leg of move or write 'pass' in the Moves field" 919 gosub legalmoves2 king 920 continuemove 921 elseif sub stalemated KING 922 endif 923 end 924