Please report any bugs or errors to Adam DeWitt
You may not move a bg from 8k to 5h
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 7j-7i 1... P 5d-5e 2. p 9j-9i 2... P 9d-9e 3. p 5j-5i 3... P 7d-7e 4. bg 8k-5h 4... DH 10c-5h 5. p 5i-5h 5... BG 6c-8e 6. p 8j-8i 6... P 9e-9f 7. p 6j-6i 7... LN 6b-7d 8. p 2j-2i 8... D 4e-4f 9. fd 7l-7j 9... LN 7d-6f 10. ln 8l-8j 10... P 9f-9g 11. s 10m-9l 11... FD 7b-5d 12. ln 8j-8h 12... BT 6a-7b 13. ln 8h-9g; ln 9g-8h 13... P 2d-2e 14. fd 7j-4h 14... LN 6f-8h 15. p 8i-8h 15... B 3c-1e 16. rg 7k-7c; +rg-dest 16... Q 8b-7c 17. fd 4h-6h 17... Q 7c-7d 18. d 4i-4h 18... P 7e-7f 19. vg 6k-9h 19... DK 9c-9h 20. p 9i-9h 20... P 4d-4e 21. p 5h-5g 21... D 10e-10f 22. dh 10k-8i 22... P 10d-10e 23. s 4m-5l 23... B 11c-6h 24. p 6i-6h 24... S 4a-5b 25. s 9l-8k 25... FD 5d-7g 26. s 8k-7j 26... R 12c-9c 27. resign // - Aurelian Florea has resigned. -If this is your settings file, you may edit it at https://www.chessvariants.com/play/pbm/play.php?game=Mitsugumi+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 4 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 0 793 MOVE: p 7j-7i 794 postauto1 795 preauto2 796 moveindex 1 797 MOVE: P 5d-5e 798 postauto2 799 preauto1 800 moveindex 2 801 MOVE: p 9j-9i 802 postauto1 803 preauto2 804 moveindex 3 805 MOVE: P 9d-9e 806 postauto2 807 preauto1 808 moveindex 4 809 MOVE: p 5j-5i 810 postauto1 811 preauto2 812 moveindex 5 813 MOVE: P 7d-7e 814 postauto2 815 preauto1 816 moveindex 6 817 MOVE: bg 8k-5h 818 postauto1 819 preauto2 820 moveindex 7 821 MOVE: DH 10c-5h 822 postauto2 823 preauto1 824 moveindex 8 825 MOVE: p 5i-5h 826 postauto1 827 preauto2 828 moveindex 9 829 MOVE: BG 6c-8e 830 postauto2 831 preauto1 832 moveindex 10 833 MOVE: p 8j-8i 834 postauto1 835 preauto2 836 moveindex 11 837 MOVE: P 9e-9f 838 postauto2 839 preauto1 840 moveindex 12 841 MOVE: p 6j-6i 842 postauto1 843 preauto2 844 moveindex 13 845 MOVE: LN 6b-7d 846 postauto2 847 preauto1 848 moveindex 14 849 MOVE: p 2j-2i 850 postauto1 851 preauto2 852 moveindex 15 853 MOVE: D 4e-4f 854 postauto2 855 preauto1 856 moveindex 16 857 MOVE: fd 7l-7j 858 postauto1 859 preauto2 860 moveindex 17 861 MOVE: LN 7d-6f 862 postauto2 863 preauto1 864 moveindex 18 865 MOVE: ln 8l-8j 866 postauto1 867 preauto2 868 moveindex 19 869 MOVE: P 9f-9g 870 postauto2 871 preauto1 872 moveindex 20 873 MOVE: s 10m-9l 874 postauto1 875 preauto2 876 moveindex 21 877 MOVE: FD 7b-5d 878 postauto2 879 preauto1 880 moveindex 22 881 MOVE: ln 8j-8h 882 postauto1 883 preauto2 884 moveindex 23 885 MOVE: BT 6a-7b 886 postauto2 887 preauto1 888 moveindex 24 889 MOVE: ln 8h-9g 890 MOVE: ln 9g-8h 891 postauto1 892 preauto2 893 moveindex 25 894 MOVE: P 2d-2e 895 postauto2 896 preauto1 897 moveindex 26 898 MOVE: fd 7j-4h 899 postauto1 900 preauto2 901 moveindex 27 902 MOVE: LN 6f-8h 903 postauto2 904 preauto1 905 moveindex 28 906 MOVE: p 8i-8h 907 postauto1 908 preauto2 909 moveindex 29 910 MOVE: B 3c-1e 911 postauto2 912 preauto1 913 moveindex 30 914 MOVE: rg 7k-7c 915 MOVE: +rg-dest 916 postauto1 917 preauto2 918 moveindex 31 919 MOVE: Q 8b-7c 920 postauto2 921 preauto1 922 moveindex 32 923 MOVE: fd 4h-6h 924 postauto1 925 preauto2 926 moveindex 33 927 MOVE: Q 7c-7d 928 postauto2 929 preauto1 930 moveindex 34 931 MOVE: d 4i-4h 932 postauto1 933 preauto2 934 moveindex 35 935 MOVE: P 7e-7f 936 postauto2 937 preauto1 938 moveindex 36 939 MOVE: vg 6k-9h 940 postauto1 941 preauto2 942 moveindex 37 943 MOVE: DK 9c-9h 944 postauto2 945 preauto1 946 moveindex 38 947 MOVE: p 9i-9h 948 postauto1 949 preauto2 950 moveindex 39 951 MOVE: P 4d-4e 952 postauto2 953 preauto1 954 moveindex 40 955 MOVE: p 5h-5g 956 postauto1 957 preauto2 958 moveindex 41 959 MOVE: D 10e-10f 960 postauto2 961 preauto1 962 moveindex 42 963 MOVE: dh 10k-8i 964 postauto1 965 preauto2 966 moveindex 43 967 MOVE: P 10d-10e 968 postauto2 969 preauto1 970 moveindex 44 971 MOVE: s 4m-5l 972 postauto1 973 preauto2 974 moveindex 45 975 MOVE: B 11c-6h 976 postauto2 977 preauto1 978 moveindex 46 979 MOVE: p 6i-6h 980 postauto1 981 preauto2 982 moveindex 47 983 MOVE: S 4a-5b 984 postauto2 985 preauto1 986 moveindex 48 987 MOVE: s 9l-8k 988 postauto1 989 preauto2 990 moveindex 49 991 MOVE: FD 5d-7g 992 postauto2 993 preauto1 994 moveindex 50 995 MOVE: s 8k-7j 996 postauto1 997 preauto2 998 moveindex 51 999 MOVE: R 12c-9c 1000 postauto2 1001 preauto1 1002 moveindex 52 1003 MOVE: resign 1004 postauto1 1005 preauto2 1006 if >= #bskips 1 and >= #wskips 1 1007 die You may not skip a turn when the immediately preceding turn was skipped by the opponent. 1008 endif 1009 if not findpiece K spaces and not findpiece +DE spaces 1010 say All Royals Captured! Black has won! 1011 won 1012 endif 1013 set posvar join "b" join fencode boardflags 1014 if >= var #posvar 4 and < #bskips 2 1015 say Four Times Repetition! Drawn Game! 1016 drawn 1017 endif 1018 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 1019 remind "Enter second leg of move or press Pass" 1020 gosub legalmoves2 king 1021 continuemove 1022 elseif sub stalemated KING 1023 endif 1024 end 1025