You may not capture your own pieces, except by suicide.

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 f2-f3 
1... p d7-d6 
2. P d2-d3 
2... p b7-b6 
3. P b2-b3 
3... p f7-f6 
4. P a2-c4 
4... p e7-e6 
5. P e2-e3 
5... p f6-e5 
6. P g2-f2 
6... p b6-c5 
7. P f3-g4 
7... p c5-c3 
8. P e3-c3 
8... i a8-g2 
9. P d3-e2 
9... i g2-c6 
10. P c3-c5 
10... i c6-f3 
11. S h1-f3 
11... w b8-b4 
12. P g4-h3 
12... a g8-f7 
13. P h3-h1 
13... w b4-b5 
14. A g1-g6 
14... l f8-g7 
15. A g6-f6 
15... p d6-e7 
16. L c1-d2 
16... l c8-d7 
17. I a1-a6 
17... a f7-d5 
18. I a6-d6 
18... l g7-g6 
19. A f6-e6 
19... l g6-f6 
20. P e2-e3 
20... p h7-g6 
21. L f1-a6 
21... p a7-b8 
22. P f2-d4 
22... l f6-f4 
23. P d4-b6 
23... @-c7 
24. I d6-c7 
24... resign

If this is your settings file, you may edit it at https://www.chessvariants.com/play/pbm/play.php?game=Rococo&settings=Alfaerie&submit=Edit

Here is a code listing:

   0 set k d8
   1 set K d1
   2 set i a8
   3 set I a1
   4 sub postauto1
   5   set suicide and equal origin #oorigin equal moved #omoved
   6   if and and isupper old not #suicide and not equal moved S or not equal moved C not equal old S
   7     die You may not capture your own pieces, except by suicide.
   8   endif
   9   if and and islower old not #suicide and and and not equal moved K not equal moved S not equal moved P or not equal moved C not match old k p s
  10     die Only the King and the Pawn (or the Chameleon) may capture by replacement, and only the Swapper (or the Chameleon) may capture by mutual destruction
  11   endif
  12   set border or or or equal filename dest x equal filename dest z equal rankname dest 0 equal rankname dest 9
  13   set oborder or or or equal filename origin x equal filename origin z equal rankname origin 0 equal rankname origin 9
  14   if and and equal origin #oorigin equal dest #odest match moved C S
  15     die A swapped piece may not swap back immediately.
  16   endif
  17   set odest dest
  18   set immobilized true
  19   if and #i equal #i where origin 1 0
  20   elseif and #i equal #i where origin 1 1
  21   elseif and #i equal #i where origin 0 1
  22   elseif and #i equal #i where origin neg 1 1
  23   elseif and #i equal #i where origin neg 1 0
  24   elseif and #i equal #i where origin neg 1 neg 1
  25   elseif and #i equal #i where origin 0 neg 1
  26   elseif and #i equal #i where origin 1 neg 1
  27   elseif and equal moved I equal c what origin 1 0
  28   elseif and equal moved I equal c what origin 1 1
  29   elseif and equal moved I equal c what origin 0 1
  30   elseif and equal moved I equal c what origin neg 1 1
  31   elseif and equal moved I equal c what origin neg 1 0
  32   elseif and equal moved I equal c what origin neg 1 neg 1
  33   elseif and equal moved I equal c what origin 0 neg 1
  34   elseif and equal moved I equal c what origin 1 neg 1
  35   else
  36     set immobilized false
  37   endif
  38   set simmobilized true
  39   if equal i what dest 1 0
  40   elseif equal i what dest 1 1
  41   elseif equal i what dest 0 1
  42   elseif equal i what dest neg 1 1
  43   elseif equal i what dest neg 1 0
  44   elseif equal i what dest neg 1 neg 1
  45   elseif equal i what dest 0 neg 1
  46   elseif equal i what dest 1 neg 1
  47   elseif and equal dest #I equal c what dest 1 0
  48   elseif and equal dest #I equal c what dest 1 1
  49   elseif and equal dest #I equal c what dest 0 1
  50   elseif and equal dest #I equal c what dest neg 1 1
  51   elseif and equal dest #I equal c what dest neg 1 0
  52   elseif and equal dest #I equal c what dest neg 1 neg 1
  53   elseif and equal dest #I equal c what dest 0 neg 1
  54   elseif and equal dest #I equal c what dest 1 neg 1
  55   else
  56     set simmobilized false
  57   endif
  58   if and #immobilized not #suicide
  59     die An immobilized piece may only commit suicide.
  60   endif
  61   if and not #simmobilized #suicide
  62     set pp space dest
  63     die Only an immobilized piece may only commit suicide.
  64   endif
  65   if and unequal space dest moved not #suicide
  66     set pp space dest
  67     if and equal moved P unequal #pp P
  68       if not match rankname dest 8 9
  69         die You may not promote a Pawn until it reaches one of the last two ranks.
  70       elseif not match #pp I A W L S C
  71         die You may not promote your Pawn to a #pp .
  72       else
  73         add K dest
  74         set f1 findpiece #pp x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 z0 z1 z2 z3 z4 z5 z6 z7 z8 z9
  75         set f2 findpiece #pp last x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 z0 z1 z2 z3 z4 z5 z6 z7 z8 z9
  76         if and onboard #f1 match #pp I W A S C
  77           die You may not promote your Pawn to a #pp until one has been captured.
  78         endif
  79         if and unequal #f1 #f2 match #pp L
  80           die You may not promote your Pawn to a #pp until one has been captured.
  81         endif
  82         add #pp dest
  83       endif
  84       if equal #pp I
  85         set I dest
  86       endif
  87     elseif or and unequal moved S or unequal moved C unequal old s unequal #pp @
  88       die You may not change the type of this piece.
  89     elseif or nor checkleap origin dest 1 0 checkleap origin dest 1 1 not islower old
  90       die A Swapper (or a Chameleon) may only explode with an adjacent enemy piece.
  91     endif
  92   endif
  93   set legal false
  94   if #suicide
  95     if equal #I dest
  96       set I null
  97     endif
  98   elseif equal moved P
  99     set necessity capture
 100     set legal or and not capture or checkleap origin dest 1 0 checkleap origin dest 1 1 or and checkleap origin dest 2 0 checkhop origin dest 1 0 and checkleap origin dest 2 2 checkhop origin dest 1 1
 101     if equal i old
 102       set i null
 103     endif
 104   elseif equal moved I
 105     set I dest
 106     set necessity false
 107     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 108   elseif equal moved W
 109     set necessity or checkleap origin dest 1 0 checkleap origin dest 1 1
 110     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 111     set target where origin cmp file origin file dest cmp rank origin rank dest
 112     set necessity and #necessity islower space #target
 113     if islower space #target
 114       capture #target
 115     endif
 116   elseif equal moved A
 117     set necessity false
 118     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 119     set target where dest cmp file dest file origin cmp rank dest rank origin
 120     if islower space #target
 121       set necessity true
 122       if equal #i #target
 123         set i null
 124       endif
 125       capture #target
 126     endif
 127   elseif equal moved L
 128     set legal or or equal file origin file dest equal rank origin rank dest equal abs minus file origin file dest abs minus rank origin rank dest
 129     set necessity islower what dest cmp file origin file dest cmp rank origin rank dest
 130     set screen1 null
 131     set screen2 null
 132     set screen3 null
 133     set screen4 null
 134     set step origin
 135     if not or checkride origin dest 1 1 checkride origin dest 1 0
 136       set screen1 where origin cmp file dest file origin cmp rank dest rank origin
 137       if empty #screen1
 138         set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 139         if empty #screen1
 140           set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 141           if empty #screen1
 142             set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 143             if empty #screen1
 144               set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 145               if empty #screen1
 146                 set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 147                 if empty #screen1
 148                   set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 149                   if empty #screen1
 150                     set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 151                   endif
 152                 endif
 153               endif
 154             endif
 155           endif
 156         endif
 157       endif
 158       if isupper space #screen1
 159         set legal false
 160       endif
 161       if equal #i #screen1
 162         set i null
 163       endif
 164       capture #screen1
 165       if not or checkride #screen1 dest 1 1 checkride #screen1 dest 1 0
 166         set screen2 where #screen1 cmp file dest file origin cmp rank dest rank origin
 167         if not empty #screen2
 168           set legal false
 169         endif
 170         set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 171         if empty #screen2
 172           set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 173           if empty #screen2
 174             set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 175             if empty #screen2
 176               set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 177               if empty #screen2
 178                 set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 179                 if empty #screen2
 180                   set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 181                 endif
 182               endif
 183             endif
 184           endif
 185         endif
 186         if isupper space #screen2
 187           set legal false
 188         endif
 189         if equal #i #screen2
 190           set i null
 191         endif
 192         capture #screen2
 193         if not or checkride #screen2 dest 1 1 checkride #screen2 dest 1 0
 194           set screen3 where #screen2 cmp file dest file origin cmp rank dest rank origin
 195           if not empty #screen3
 196             set legal false
 197           endif
 198           set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 199           if empty #screen3
 200             set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 201             if empty #screen3
 202               set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 203               if empty #screen3
 204                 set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 205               endif
 206             endif
 207           endif
 208           if isupper space #screen3
 209             set legal false
 210           endif
 211           if equal #i #screen3
 212             set i null
 213           endif
 214           capture #screen3
 215           if not or checkride #screen3 dest 1 1 checkride #screen3 dest 1 0
 216             set screen4 where #screen3 cmp file dest file origin cmp rank dest rank origin
 217             if not empty #screen4
 218               set legal false
 219             endif
 220             set screen4 where #screen4 cmp file dest file origin cmp rank dest rank origin
 221             if empty #screen4
 222               set screen4 where #screen4 cmp file dest file origin cmp rank dest rank origin
 223             endif
 224             if isupper space #screen4
 225               set legal false
 226             endif
 227             if equal #i #screen4
 228               set i null
 229             endif
 230             capture #screen4
 231             if not or checkride #screen4 dest 1 1 checkride #screen4 dest 1 0
 232               set legal false
 233             endif
 234           endif
 235         endif
 236       endif
 237     endif
 238   elseif equal moved S
 239     set necessity capture
 240     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 241     if equal i old
 242       set i origin
 243     endif
 244     if equal I old
 245       set I origin
 246     endif
 247     if equal k old
 248       set k origin
 249     endif
 250     if equal K old
 251       set K origin
 252     endif
 253     if unequal space dest @
 254       add old origin
 255     endif
 256   elseif equal moved C
 257     set oldd old
 258     set necessityw equal w what dest mult 2 cmp file origin file dest mult 2 cmp rank origin rank dest and equal w what origin cmp file origin file dest cmp rank origin rank dest
 259     set necessitya equal a what dest cmp file dest file origin cmp rank dest rank origin
 260     set necessityl equal l what dest cmp file origin file dest cmp rank origin rank dest
 261     set necessity or or or capture #necessityl #necessityw #necessitya
 262     set legal or or equal file origin file dest equal rank origin rank dest equal abs minus file origin file dest abs minus rank origin rank dest
 263     set screen1 null
 264     set screen2 null
 265     if not equal old p
 266       if not or checkride origin dest 1 1 checkride origin dest 1 0
 267         set screen1 where origin cmp file dest file origin cmp rank dest rank origin
 268         if empty #screen1
 269           set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 270           if empty #screen1
 271             set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 272             if empty #screen1
 273               set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 274               if empty #screen1
 275                 set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 276                 if empty #screen1
 277                   set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 278                   if empty #screen1
 279                     set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 280                     if empty #screen1
 281                       set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 282                     endif
 283                   endif
 284                 endif
 285               endif
 286             endif
 287           endif
 288         endif
 289         if not equal l space #screen1
 290           set legal false
 291         endif
 292         capture #screen1
 293         if not or checkride #screen1 dest 1 1 checkride #screen1 dest 1 0
 294           set screen2 where #screen1 cmp file dest file origin cmp rank dest rank origin
 295           if not empty #screen2
 296             set legal false
 297           endif
 298           set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 299           if empty #screen2
 300             set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 301             if empty #screen2
 302               set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 303               if empty #screen2
 304                 set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 305                 if empty #screen2
 306                   set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 307                   if empty #screen2
 308                     set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 309                   endif
 310                 endif
 311               endif
 312             endif
 313           endif
 314           if not equal l space #screen2
 315             set legal false
 316           endif
 317           capture #screen2
 318           if not or checkride #screen2 dest 1 1 checkride #screen2 dest 1 0
 319             set legal false
 320           endif
 321         endif
 322       endif
 323     else
 324       set legal or and checkleap origin dest 2 0 checkhop origin dest 1 0 and checkleap origin dest 2 2 checkhop origin dest 1 1
 325       set screen1 where dest cmp file origin file dest cmp rank origin rank dest
 326       if equal l #screen1
 327         capture #screen1
 328       endif
 329     endif
 330     if unequal space dest @
 331       set wtarget where origin cmp file origin file dest cmp rank origin rank dest
 332       if equal w space #wtarget
 333         capture #wtarget
 334       endif
 335       set atarget where dest cmp file dest file origin cmp rank dest rank origin
 336       if equal a space #atarget
 337         capture #atarget
 338       endif
 339       if match #oldd S s
 340         add #oldd origin
 341       endif
 342     endif
 343   elseif equal moved K
 344     set K dest
 345     set necessity capture
 346     set legal or checkleap origin dest 1 1 checkleap origin dest 1 0
 347   endif
 348   set legal or #legal #suicide
 349   if not var legal
 350     die You may not move a moved from origin to #odest
 351   endif
 352   if and and #border not #necessity not #suicide
 353     die You may move to a border square only to capture a piece which couldn't be captured otherwise.
 354   endif
 355   set legal false
 356   set neigh1 where #I 1 0
 357   set neigh2 where #I 1 1
 358   set neigh3 where #I 0 1
 359   set neigh4 where #I neg 1 1
 360   set neigh5 where #I neg 1 0
 361   set neigh6 where #I neg 1 neg 1
 362   set neigh7 where #I 0 neg 1
 363   set neigh8 where #I 1 neg 1
 364   convert #neigh1 a b k q p o l m s t w v c y
 365   convert #neigh2 a b k q p o l m s t w v c y
 366   convert #neigh3 a b k q p o l m s t w v c y
 367   convert #neigh4 a b k q p o l m s t w v c y
 368   convert #neigh5 a b k q p o l m s t w v c y
 369   convert #neigh6 a b k q p o l m s t w v c y
 370   convert #neigh7 a b k q p o l m s t w v c y
 371   convert #neigh8 a b k q p o l m s t w v c y
 372   if and not equal a what #K 1 0 match insight #K 1 0 a
 373   elseif and not equal a what #K 1 1 match insight #K 1 1 a
 374   elseif and not equal a what #K 0 1 match insight #K 0 1 a
 375   elseif and not equal a what #K neg 1 1 match insight #K neg 1 1 a
 376   elseif and not equal a what #K neg 1 0 match insight #K neg 1 0 a
 377   elseif and not equal a what #K neg 1 neg 1 match insight #K neg 1 neg 1 a
 378   elseif and not equal a what #K 0 neg 1 match insight #K 0 neg 1 a
 379   elseif and not equal a what #K 1 neg 1 match insight #K 1 neg 1 a
 380   elseif and equal w what #K 1 0 empty where #K 2 0
 381   elseif and equal w what #K 1 1 empty where #K 2 2
 382   elseif and equal w what #K 0 1 empty where #K 0 2
 383   elseif and equal w what #K neg 1 1 empty where #K neg 2 2
 384   elseif and equal w what #K neg 1 0 empty where #K neg 2 0
 385   elseif and equal w what #K neg 1 neg 1 empty where #K neg 2 neg 2
 386   elseif and equal w what #K 0 neg 1 empty where #K 0 neg 2
 387   elseif and equal w what #K 1 neg 1 empty where #K 2 neg 2
 388   elseif and equal l insight #K 1 0 empty where #K neg 1 0
 389   elseif and equal l insight #K 1 1 empty where #K neg 1 neg 1
 390   elseif and equal l insight #K 0 1 empty where #K 0 neg 1
 391   elseif and equal l insight #K neg 1 1 empty where #K 1 neg 1
 392   elseif and equal l insight #K neg 1 0 empty where #K 1 0
 393   elseif and equal l insight #K neg 1 neg 1 empty where #K 1 1
 394   elseif and equal l insight #K 0 neg 1 empty where #K 0 1
 395   elseif and equal l insight #K 1 neg 1 empty where #K neg 1 1
 396   elseif and and and equal l behindscreen #K 1 0 isupper insight #K 1 0 empty where #K neg 1 0 empty where #K 1 0
 397   elseif and and and equal l behindscreen #K 1 1 isupper insight #K 1 1 empty where #K neg 1 neg 1 empty where #K 1 1
 398   elseif and and and equal l behindscreen #K 0 1 empty where #K 0 neg 1 empty where #K 0 1 isupper insight #K 0 1
 399   elseif and and and equal l behindscreen #K neg 1 1 isupper insight #K neg 1 1 empty where #K 1 neg 1 empty where #K neg 1 1
 400   elseif and and and equal l behindscreen #K neg 1 0 isupper insight #K neg 1 0 empty where #K 1 0 empty where #K neg 1 0
 401   elseif and and and equal l behindscreen #K neg 1 neg 1 isupper insight #K neg 1 neg 1 empty where #K 1 1 empty where #K neg 1 neg 1
 402   elseif and and and equal l behindscreen #K 0 neg 1 isupper insight #K 0 neg 1 empty where #K 0 1 empty where #K 0 neg 1
 403   elseif and and and equal l behindscreen #K 1 neg 1 isupper insight #K 1 neg 1 empty where #K neg 1 1 empty where #K 1 neg 1
 404   elseif and and and and and and and equal l what #K 6 0 empty where #K neg 1 0 empty where #K 1 0 isupper what #K 2 0 empty where #K 3 0 isupper what #K 4 0 empty where #K 5 0
 405   elseif and and and and and and and equal l what #K 6 6 empty where #K neg 1 neg 1 empty where #K 1 1 isupper what #K 2 2 empty where #K 3 3 isupper what #K 4 4 empty where #K 5 5
 406   elseif and and and and and and and equal l what #K 0 6 empty where #K 0 neg 1 empty where #K 0 1 isupper what #K 0 2 empty where #K 0 3 isupper what #K 0 4 empty where #K 0 5
 407   elseif and and and and and and and equal l what #K neg 6 6 empty where #K 1 neg 1 empty where #K neg 1 1 isupper what #K neg 2 2 empty where #K neg 3 3 isupper what #K neg 4 4 empty where #K neg 5 5
 408   elseif and and and and and and and equal l what #K neg 6 0 empty where #K 1 0 empty where #K neg 1 0 isupper what #K neg 2 0 empty where #K neg 3 0 isupper what #K neg 4 0 empty where #K neg 5 0
 409   elseif and and and and and and and equal l what #K neg 6 neg 6 empty where #K 1 1 empty where #K neg 1 neg 1 isupper what #K neg 2 neg 2 empty where #K neg 3 neg 3 isupper what #K neg 4 neg 4 empty where #K neg 5 neg 5
 410   elseif and and and and and and and equal l what #K 0 neg 6 empty where #K 0 1 empty where #K 0 neg 1 isupper what #K 0 neg 2 empty where #K 0 neg 3 isupper what #K 0 neg 4 empty where #K 0 neg 5
 411   elseif and and and and and and and equal l what #K 6 neg 6 empty where #K neg 1 1 empty where #K 1 neg 1 isupper what #K 2 neg 2 empty where #K 3 neg 3 isupper what #K 4 neg 4 empty where #K 5 neg 5
 412   elseif match what #K 1 0 k c s
 413   elseif match what #K 1 1 k c s
 414   elseif match what #K 0 1 k c s
 415   elseif match what #K neg 1 1 k c s
 416   elseif match what #K neg 1 0 k c s
 417   elseif match what #K neg 1 neg 1 k c s
 418   elseif match what #K 0 neg 1 k c s
 419   elseif match what #K 1 neg 1 k c s
 420   elseif and not empty where #K 1 0 equal p what #K 2 0
 421   elseif and not empty where #K 1 1 equal p what #K 2 2
 422   elseif and not empty where #K 0 1 equal p what #K 0 2
 423   elseif and not empty where #K neg 1 1 equal p what #K neg 2 2
 424   elseif and not empty where #K neg 1 0 equal p what #K neg 2 0
 425   elseif and not empty where #K neg 1 neg 1 equal p what #K neg 2 neg 2
 426   elseif and not empty where #K 0 neg 1 equal p what #K 0 neg 2
 427   elseif and not empty where #K 1 neg 1 equal p what #K 2 neg 2
 428   else
 429     set legal true
 430   endif
 431   if not var legal
 432     die You may not move into check
 433   endif
 434   set l null
 435   set dirv cond less 6 rank #K neg 1 1
 436   set dirh cond less 6 file #K neg 1 1
 437   if and empty where #K 0 1 empty where #K 0 neg 1
 438     set l findpiece l where #K 0 mult 6 #dirv where #K 0 mult 7 #dirv where #K 0 mult 8 #dirv where #K 0 mult 9 #dirv
 439     set step where #l 0 neg #dirv
 440     set step cond islower space #step null where #step 0 neg #dirv
 441     set step cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 442     set step cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 443     set step cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 444     set step cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 445     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 446     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 447     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step 0 #dirv null where #step 0 neg #dirv
 448     if and onboard #l equal #step #K
 449       die You may not move into check
 450     endif
 451   endif
 452   if and empty where #K 1 0 empty where #K neg 1 0
 453     set l findpiece l where #K mult 6 #dirh 0 where #K mult 7 #dirh 0 where #K mult 8 #dirh 0 where #K mult 9 #dirh 0
 454     set step where #l neg #dirh 0
 455     set step cond islower space #step null where #step neg #dirh 0
 456     set step cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 457     set step cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 458     set step cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 459     set step cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 460     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 461     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 462     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh 0 null where #step neg #dirh 0
 463     if and onboard #l equal #step #K
 464       die You may not move into check
 465     endif
 466   endif
 467   if and empty where #K #dirh #dirv empty where #K neg #dirh neg #dirv
 468     set l findpiece l where #K mult 6 #dirh mult 6 #dirv where #K mult 7 #dirh mult 7 #dirv where #K mult 8 #dirh mult 8 #dirv where #K mult 9 #dirh mult 9 #dirv
 469     set step where #l neg #dirh neg #dirv
 470     set step cond islower space #step null where #step neg #dirh neg #dirv
 471     set step cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 472     set step cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 473     set step cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 474     set step cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 475     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 476     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 477     set step cond equal #step #K #K cond or islower space #step and isupper space #step isupper what #step #dirh #dirv null where #step neg #dirh neg #dirv
 478     if and onboard #l equal #step #K
 479       die You may not move into check
 480     endif
 481   endif
 482   convert #neigh1 b a q k o p m l t s v w y c
 483   convert #neigh2 b a q k o p m l t s v w y c
 484   convert #neigh3 b a q k o p m l t s v w y c
 485   convert #neigh4 b a q k o p m l t s v w y c
 486   convert #neigh5 b a q k o p m l t s v w y c
 487   convert #neigh6 b a q k o p m l t s v w y c
 488   convert #neigh7 b a q k o p m l t s v w y c
 489   convert #neigh8 b a q k o p m l t s v w y c
 490   set oorigin origin
 491   set omoved moved
 492 endsub
 493 sub postauto2
 494   set suicide and equal origin #oorigin equal moved #omoved
 495   if and and islower old not #suicide and not equal moved s or not equal moved c not equal old s
 496     die You may not capture your own pieces, except by suicide.
 497   endif
 498   if and and isupper old not #suicide and and and not equal moved k not equal moved s not equal moved p or not equal moved c not match old K P S
 499     die Only the King and the Pawn (or the Chameleon) may capture by replacement, and only the Swapper (or the Chameleon) may capture by mutual destruction
 500   endif
 501   set border or or or equal filename dest x equal filename dest z equal rankname dest 0 equal rankname dest 9
 502   set oborder or or or equal filename origin x equal filename origin z equal rankname origin 0 equal rankname origin 9
 503   if and and equal origin #oorigin equal dest #odest match moved c s
 504     die A swapped piece may not swap back immediately.
 505   endif
 506   set odest dest
 507   set immobilized true
 508   if and #I equal #I where origin 1 0
 509   elseif and #I equal #I where origin 1 1
 510   elseif and #I equal #I where origin 0 1
 511   elseif and #I equal #I where origin neg 1 1
 512   elseif and #I equal #I where origin neg 1 0
 513   elseif and #I equal #I where origin neg 1 neg 1
 514   elseif and #I equal #I where origin 0 neg 1
 515   elseif and #I equal #I where origin 1 neg 1
 516   elseif and equal moved i equal C what origin 1 0
 517   elseif and equal moved i equal C what origin 1 1
 518   elseif and equal moved i equal C what origin 0 1
 519   elseif and equal moved i equal C what origin neg 1 1
 520   elseif and equal moved i equal C what origin neg 1 0
 521   elseif and equal moved i equal C what origin neg 1 neg 1
 522   elseif and equal moved i equal C what origin 0 neg 1
 523   elseif and equal moved i equal C what origin 1 neg 1
 524   else
 525     set immobilized false
 526   endif
 527   set simmobilized true
 528   if equal I what dest 1 0
 529   elseif equal I what dest 1 1
 530   elseif equal I what dest 0 1
 531   elseif equal I what dest neg 1 1
 532   elseif equal I what dest neg 1 0
 533   elseif equal I what dest neg 1 neg 1
 534   elseif equal I what dest 0 neg 1
 535   elseif equal I what dest 1 neg 1
 536   elseif and equal dest #i equal C what dest 1 0
 537   elseif and equal dest #i equal C what dest 1 1
 538   elseif and equal dest #i equal C what dest 0 1
 539   elseif and equal dest #i equal C what dest neg 1 1
 540   elseif and equal dest #i equal C what dest neg 1 0
 541   elseif and equal dest #i equal C what dest neg 1 neg 1
 542   elseif and equal dest #i equal C what dest 0 neg 1
 543   elseif and equal dest #i equal C what dest 1 neg 1
 544   else
 545     set simmobilized false
 546   endif
 547   if and #immobilized not #suicide
 548     die An immobilized piece may only commit suicide.
 549   endif
 550   if and not #simmobilized #suicide
 551     die Only an immobilized piece may only commit suicide.
 552   endif
 553   if and unequal space dest moved not #suicide
 554     set pp space dest
 555     if and equal moved p unequal #pp p
 556       if not match rankname dest 0 1
 557         die You may not promote a Pawn until it reaches one of the last two ranks.
 558       elseif not match #pp i a w l s c
 559         die You may not promote your Pawn to a #pp .
 560       else
 561         add k dest
 562         set f1 findpiece #pp x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 z0 z1 z2 z3 z4 z5 z6 z7 z8 z9
 563         set f2 findpiece #pp last x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 a0 a1 a2 a3 a4 a5 a6 a7 a8 a9 b0 b1 b2 b3 b4 b5 b6 b7 b8 b9 c0 c1 c2 c3 c4 c5 c6 c7 c8 c9 d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 e0 e1 e2 e3 e4 e5 e6 e7 e8 e9 f0 f1 f2 f3 f4 f5 f6 f7 f8 f9 g0 g1 g2 g3 g4 g5 g6 g7 g8 g9 h0 h1 h2 h3 h4 h5 h6 h7 h8 h9 z0 z1 z2 z3 z4 z5 z6 z7 z8 z9
 564         if and onboard #f1 match #pp i a w l s c
 565           die You may not promote your Pawn to a #pp until one has been captured.
 566         endif
 567         add #pp dest
 568       endif
 569       if equal #pp i
 570         set i dest
 571       endif
 572     elseif or and unequal moved s or unequal moved c unequal old S unequal #pp @
 573       die You may not change the type of this piece.
 574     elseif or nor checkleap origin dest 1 0 checkleap origin dest 1 1 not isupper old
 575       die A Swapper (or a Chameleon) may only explode with an adjacent enemy piece.
 576     endif
 577   endif
 578   set legal false
 579   if #suicide
 580     if equal #i dest
 581       set i null
 582     endif
 583   elseif equal moved p
 584     set necessity capture
 585     set legal or and not capture or checkleap origin dest 1 0 checkleap origin dest 1 1 or and checkleap origin dest 2 0 checkhop origin dest 1 0 and checkleap origin dest 2 2 checkhop origin dest 1 1
 586     if equal I old
 587       set I null
 588     endif
 589   elseif equal moved i
 590     set i dest
 591     set necessity false
 592     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 593   elseif equal moved w
 594     set necessity or or checkleap origin dest 1 0 checkleap origin dest 1 1 #oborder
 595     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 596     set target where origin cmp file origin file dest cmp rank origin rank dest
 597     set necessity and #necessity isupper space #target
 598     if isupper space #target
 599       capture #target
 600     endif
 601   elseif equal moved a
 602     set necessity false
 603     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 604     set target where dest cmp file dest file origin cmp rank dest rank origin
 605     if isupper space #target
 606       set necessity true
 607       if equal #I #target
 608         set I null
 609       endif
 610       capture #target
 611     endif
 612   elseif equal moved l
 613     set legal or or equal file origin file dest equal rank origin rank dest equal abs minus file origin file dest abs minus rank origin rank dest
 614     set necessity isupper what dest cmp file origin file dest cmp rank origin rank dest
 615     set screen1 null
 616     set screen2 null
 617     set screen3 null
 618     set screen4 null
 619     set step origin
 620     if not or checkride origin dest 1 1 checkride origin dest 1 0
 621       set screen1 where origin cmp file dest file origin cmp rank dest rank origin
 622       if empty #screen1
 623         set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 624         if empty #screen1
 625           set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 626           if empty #screen1
 627             set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 628             if empty #screen1
 629               set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 630               if empty #screen1
 631                 set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 632                 if empty #screen1
 633                   set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 634                   if empty #screen1
 635                     set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 636                   endif
 637                 endif
 638               endif
 639             endif
 640           endif
 641         endif
 642       endif
 643       if islower space #screen1
 644         set legal false
 645       endif
 646       if equal #I #screen1
 647         set I null
 648       endif
 649       capture #screen1
 650       if not or checkride #screen1 dest 1 1 checkride #screen1 dest 1 0
 651         set screen2 where #screen1 cmp file dest file origin cmp rank dest rank origin
 652         if not empty #screen2
 653           set legal false
 654         endif
 655         set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 656         if empty #screen2
 657           set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 658           if empty #screen2
 659             set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 660             if empty #screen2
 661               set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 662               if empty #screen2
 663                 set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 664                 if empty #screen2
 665                   set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 666                 endif
 667               endif
 668             endif
 669           endif
 670         endif
 671         if islower space #screen2
 672           set legal false
 673         endif
 674         if equal #I #screen2
 675           set I null
 676         endif
 677         capture #screen2
 678         if not or checkride #screen2 dest 1 1 checkride #screen2 dest 1 0
 679           set screen3 where #screen2 cmp file dest file origin cmp rank dest rank origin
 680           if not empty #screen3
 681             set legal false
 682           endif
 683           set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 684           if empty #screen3
 685             set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 686             if empty #screen3
 687               set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 688               if empty #screen3
 689                 set screen3 where #screen3 cmp file dest file origin cmp rank dest rank origin
 690               endif
 691             endif
 692           endif
 693           if islower space #screen3
 694             set legal false
 695           endif
 696           if equal #I #screen3
 697             set I null
 698           endif
 699           capture #screen3
 700           if not or checkride #screen3 dest 1 1 checkride #screen3 dest 1 0
 701             set screen4 where #screen3 cmp file dest file origin cmp rank dest rank origin
 702             if not empty #screen4
 703               set legal false
 704             endif
 705             set screen4 where #screen4 cmp file dest file origin cmp rank dest rank origin
 706             if empty #screen4
 707               set screen4 where #screen4 cmp file dest file origin cmp rank dest rank origin
 708             endif
 709             if islower space #screen4
 710               set legal false
 711             endif
 712             if equal #I #screen4
 713               set I null
 714             endif
 715             capture #screen4
 716             if not or checkride #screen4 dest 1 1 checkride #screen4 dest 1 0
 717               set legal false
 718             endif
 719           endif
 720         endif
 721       endif
 722     endif
 723   elseif equal moved s
 724     set necessity capture
 725     set legal or checkride origin dest 1 1 checkride origin dest 1 0
 726     if equal I old
 727       set I origin
 728     endif
 729     if equal i old
 730       set i origin
 731     endif
 732     if equal K old
 733       set K origin
 734     endif
 735     if equal k old
 736       set k origin
 737     endif
 738     if unequal space dest @
 739       add old origin
 740     endif
 741   elseif equal moved c
 742     set oldd old
 743     set necessityw equal W what dest mult 2 cmp file origin file dest mult 2 cmp rank origin rank dest and equal W what origin cmp file origin file dest cmp rank origin rank dest
 744     set necessitya equal A what dest cmp file dest file origin cmp rank dest rank origin
 745     set necessityl equal L what dest cmp file origin file dest cmp rank origin rank dest
 746     set necessity or or or capture #necessityl #necessityw #necessitya
 747     set legal or or equal file origin file dest equal rank origin rank dest equal abs minus file origin file dest abs minus rank origin rank dest
 748     set screen1 null
 749     set screen2 null
 750     if not equal old P
 751       if not or checkride origin dest 1 1 checkride origin dest 1 0
 752         set screen1 where origin cmp file dest file origin cmp rank dest rank origin
 753         if empty #screen1
 754           set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 755           if empty #screen1
 756             set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 757             if empty #screen1
 758               set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 759               if empty #screen1
 760                 set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 761                 if empty #screen1
 762                   set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 763                   if empty #screen1
 764                     set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 765                     if empty #screen1
 766                       set screen1 where #screen1 cmp file dest file origin cmp rank dest rank origin
 767                     endif
 768                   endif
 769                 endif
 770               endif
 771             endif
 772           endif
 773         endif
 774         if not equal L space #screen1
 775           set legal false
 776         endif
 777         capture #screen1
 778         if not or checkride #screen1 dest 1 1 checkride #screen1 dest 1 0
 779           set screen2 where #screen1 cmp file dest file origin cmp rank dest rank origin
 780           if not empty #screen2
 781             set legal false
 782           endif
 783           set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 784           if empty #screen2
 785             set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 786             if empty #screen2
 787               set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 788               if empty #screen2
 789                 set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 790                 if empty #screen2
 791                   set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 792                   if empty #screen2
 793                     set screen2 where #screen2 cmp file dest file origin cmp rank dest rank origin
 794                   endif
 795                 endif
 796               endif
 797             endif
 798           endif
 799           if not equal L space #screen2
 800             set legal false
 801           endif
 802           capture #screen2
 803           if not or checkride #screen2 dest 1 1 checkride #screen2 dest 1 0
 804             set legal false
 805           endif
 806         endif
 807       endif
 808     else
 809       set legal and equal old P or and checkleap origin dest 2 0 checkhop origin dest 1 0 and checkleap origin dest 2 2 checkhop origin dest 1 1
 810       set screen1 where dest cmp file origin file dest cmp rank origin rank dest
 811       if equal L #screen1
 812         capture #screen1
 813       endif
 814     endif
 815     if unequal space dest @
 816       set wtarget where origin cmp file origin file dest cmp rank origin rank dest
 817       if equal W space #wtarget
 818         capture #wtarget
 819       endif
 820       set atarget where dest cmp file dest file origin cmp rank dest rank origin
 821       if equal A space #atarget
 822         capture #atarget
 823       endif
 824       if match #oldd S s
 825         add #oldd origin
 826       endif
 827     endif
 828   elseif equal moved k
 829     set k dest
 830     set necessity capture
 831     set legal or checkleap origin dest 1 1 checkleap origin dest 1 0
 832   endif
 833   set legal or #legal #suicide
 834   if not var legal
 835     die You may not move a moved from origin to #odest
 836   endif
 837   if and and #border not #necessity not #suicide
 838     die You may move to a border square only to capture a piece which couldn't be captured otherwise.
 839   endif
 840   set legal false
 841   set neigh1 where #i 1 0
 842   set neigh2 where #i 1 1
 843   set neigh3 where #i 0 1
 844   set neigh4 where #i neg 1 1
 845   set neigh5 where #i neg 1 0
 846   set neigh6 where #i neg 1 neg 1
 847   set neigh7 where #i 0 neg 1
 848   set neigh8 where #i 1 neg 1
 849   convert #neigh1 A B K Q P O L M S T W V C Y
 850   convert #neigh2 A B K Q P O L M S T W V C Y
 851   convert #neigh3 A B K Q P O L M S T W V C Y
 852   convert #neigh4 A B K Q P O L M S T W V C Y
 853   convert #neigh5 A B K Q P O L M S T W V C Y
 854   convert #neigh6 A B K Q P O L M S T W V C Y
 855   convert #neigh7 A B K Q P O L M S T W V C Y
 856   convert #neigh8 A B K Q P O L M S T W V C Y
 857   if and not equal A what #k 1 0 match insight #k 1 0 A
 858   elseif and not equal A what #k 1 1 match insight #k 1 1 A
 859   elseif and not equal A what #k 0 1 match insight #k 0 1 A
 860   elseif and not equal A what #k neg 1 1 match insight #k neg 1 1 A
 861   elseif and not equal A what #k neg 1 0 match insight #k neg 1 0 A
 862   elseif and not equal A what #k neg 1 neg 1 match insight #k neg 1 neg 1 A
 863   elseif and not equal A what #k 0 neg 1 match insight #k 0 neg 1 A
 864   elseif and not equal A what #k 1 neg 1 match insight #k 1 neg 1 A
 865   elseif and equal W what #k 1 0 empty where #k 2 0
 866   elseif and equal W what #k 1 1 empty where #k 2 2
 867   elseif and equal W what #k 0 1 empty where #k 0 2
 868   elseif and equal W what #k neg 1 1 empty where #k neg 2 2
 869   elseif and equal W what #k neg 1 0 empty where #k neg 2 0
 870   elseif and equal W what #k neg 1 neg 1 empty where #k neg 2 neg 2
 871   elseif and equal W what #k 0 neg 1 empty where #k 0 neg 2
 872   elseif and equal W what #k 1 neg 1 empty where #k 2 neg 2
 873   elseif and equal L insight #k 1 0 empty where #k neg 1 0
 874   elseif and equal L insight #k 1 1 empty where #k neg 1 neg 1
 875   elseif and equal L insight #k 0 1 empty where #k 0 neg 1
 876   elseif and equal L insight #k neg 1 1 empty where #k 1 neg 1
 877   elseif and equal L insight #k neg 1 0 empty where #k 1 0
 878   elseif and equal L insight #k neg 1 neg 1 empty where #k 1 1
 879   elseif and equal L insight #k 0 neg 1 empty where #k 0 1
 880   elseif and equal L insight #k 1 neg 1 empty where #k neg 1 1
 881   elseif and and and equal L behindscreen #k 1 0 islower insight #k 1 0 empty where #k neg 1 0 empty where #k 1 0
 882   elseif and and and equal L behindscreen #k 1 1 islower insight #k 1 1 empty where #k neg 1 neg 1 empty where #k 1 1
 883   elseif and and and equal L behindscreen #k 0 1 empty where #k 0 neg 1 empty where #k 0 1 islower insight #k 0 1
 884   elseif and and and equal L behindscreen #k neg 1 1 islower insight #k neg 1 1 empty where #k 1 neg 1 empty where #k neg 1 1
 885   elseif and and and equal L behindscreen #k neg 1 0 islower insight #k neg 1 0 empty where #k 1 0 empty where #k neg 1 0
 886   elseif and and and equal L behindscreen #k neg 1 neg 1 islower insight #k neg 1 neg 1 empty where #k 1 1 empty where #k neg 1 neg 1
 887   elseif and and and equal L behindscreen #k 0 neg 1 islower insight #k 0 neg 1 empty where #k 0 1 empty where #k 0 neg 1
 888   elseif and and and equal L behindscreen #k 1 neg 1 islower insight #k 1 neg 1 empty where #k neg 1 1 empty where #k 1 neg 1
 889   elseif and and and and and and and equal L what #k 6 0 empty where #k neg 1 0 empty where #k 1 0 islower what #k 2 0 empty where #k 3 0 islower what #k 4 0 empty where #k 5 0
 890   elseif and and and and and and and equal L what #k 6 6 empty where #k neg 1 neg 1 empty where #k 1 1 islower what #k 2 2 empty where #k 3 3 islower what #k 4 4 empty where #k 5 5
 891   elseif and and and and and and and equal L what #k 0 6 empty where #k 0 neg 1 empty where #k 0 1 islower what #k 0 2 empty where #k 0 3 islower what #k 0 4 empty where #k 0 5
 892   elseif and and and and and and and equal L what #k neg 6 6 empty where #k 1 neg 1 empty where #k neg 1 1 islower what #k neg 2 2 empty where #k neg 3 3 islower what #k neg 4 4 empty where #k neg 5 5
 893   elseif and and and and and and and equal L what #k neg 6 0 empty where #k 1 0 empty where #k neg 1 0 islower what #k neg 2 0 empty where #k neg 3 0 islower what #k neg 4 0 empty where #k neg 5 0
 894   elseif and and and and and and and equal L what #k neg 6 neg 6 empty where #k 1 1 empty where #k neg 1 neg 1 islower what #k neg 2 neg 2 empty where #k neg 3 neg 3 islower what #k neg 4 neg 4 empty where #k neg 5 neg 5
 895   elseif and and and and and and and equal L what #k 0 neg 6 empty where #k 0 1 empty where #k 0 neg 1 islower what #k 0 neg 2 empty where #k 0 neg 3 islower what #k 0 neg 4 empty where #k 0 neg 5
 896   elseif and and and and and and and equal L what #k 6 neg 6 empty where #k neg 1 1 empty where #k 1 neg 1 islower what #k 2 neg 2 empty where #k 3 neg 3 islower what #k 4 neg 4 empty where #k 5 neg 5
 897   elseif match what #k 1 0 K C S
 898   elseif match what #k 1 1 K C S
 899   elseif match what #k 0 1 K C S
 900   elseif match what #k neg 1 1 K C S
 901   elseif match what #k neg 1 0 K C S
 902   elseif match what #k neg 1 neg 1 K C S
 903   elseif match what #k 0 neg 1 K C S
 904   elseif match what #k 1 neg 1 K C S
 905   elseif and not empty where #k 1 0 equal P what #k 2 0
 906   elseif and not empty where #k 1 1 equal P what #k 2 2
 907   elseif and not empty where #k 0 1 equal P what #k 0 2
 908   elseif and not empty where #k neg 1 1 equal P what #k neg 2 2
 909   elseif and not empty where #k neg 1 0 equal P what #k neg 2 0
 910   elseif and not empty where #k neg 1 neg 1 equal P what #k neg 2 neg 2
 911   elseif and not empty where #k 0 neg 1 equal P what #k 0 neg 2
 912   elseif and not empty where #k 1 neg 1 equal P what #k 2 neg 2
 913   else
 914     set legal true
 915   endif
 916   if not var legal
 917     die You may not move into check
 918   endif
 919   set L null
 920   set dirv cond less 6 rank #k neg 1 1
 921   set dirh cond less 6 file #k neg 1 1
 922   if and empty where #k 0 1 empty where #k 0 neg 1
 923     set L findpiece L where #k 0 mult 6 #dirv where #k 0 mult 7 #dirv where #k 0 mult 8 #dirv where #k 0 mult 9 #dirv
 924     set step where #L 0 neg #dirv
 925     set step cond isupper space #step null where #step 0 neg #dirv
 926     set step cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 927     set step cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 928     set step cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 929     set step cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 930     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 931     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 932     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step 0 #dirv null where #step 0 neg #dirv
 933     if and onboard #L equal #step #k
 934       die You may not move into check
 935     endif
 936   endif
 937   if and empty where #k 1 0 empty where #k neg 1 0
 938     set L findpiece L where #k mult 6 #dirh 0 where #k mult 7 #dirh 0 where #k mult 8 #dirh 0 where #k mult 9 #dirh 0
 939     set step where #L neg #dirh 0
 940     set step cond isupper space #step null where #step neg #dirh 0
 941     set step cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 942     set step cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 943     set step cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 944     set step cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 945     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 946     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 947     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh 0 null where #step neg #dirh 0
 948     if and onboard #L equal #step #k
 949       die You may not move into check
 950     endif
 951   endif
 952   if and empty where #k #dirh #dirv empty where #k neg #dirh neg #dirv
 953     set L findpiece L where #k mult 6 #dirh mult 6 #dirv where #k mult 7 #dirh mult 7 #dirv where #k mult 8 #dirh mult 8 #dirv where #k mult 9 #dirh mult 9 #dirv
 954     set step where #L neg #dirh neg #dirv
 955     set step cond isupper space #step null where #step neg #dirh neg #dirv
 956     set step cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 957     set step cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 958     set step cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 959     set step cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 960     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 961     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 962     set step cond equal #step #k #k cond or isupper space #step and islower space #step islower what #step #dirh #dirv null where #step neg #dirh neg #dirv
 963     if and onboard #L equal #step #k
 964       die You may not move into check
 965     endif
 966   endif
 967   convert #neigh1 B A Q K O P M L T S V W Y C
 968   convert #neigh2 B A Q K O P M L T S V W Y C
 969   convert #neigh3 B A Q K O P M L T S V W Y C
 970   convert #neigh4 B A Q K O P M L T S V W Y C
 971   convert #neigh5 B A Q K O P M L T S V W Y C
 972   convert #neigh6 B A Q K O P M L T S V W Y C
 973   convert #neigh7 B A Q K O P M L T S V W Y C
 974   convert #neigh8 B A Q K O P M L T S V W Y C
 975   set oorigin origin
 976   set omoved moved
 977 endsub
 978 moveindex 0
 979 MOVE: P f2-f3
 980 postauto1
 981 moveindex 1
 982 MOVE: p d7-d6
 983 postauto2
 984 moveindex 2
 985 MOVE: P d2-d3
 986 postauto1
 987 moveindex 3
 988 MOVE: p b7-b6
 989 postauto2
 990 moveindex 4
 991 MOVE: P b2-b3
 992 postauto1
 993 moveindex 5
 994 MOVE: p f7-f6
 995 postauto2
 996 moveindex 6
 997 MOVE: P a2-c4
 998 postauto1
 999 moveindex 7
1000 MOVE: p e7-e6
1001 postauto2
1002 moveindex 8
1003 MOVE: P e2-e3
1004 postauto1
1005 moveindex 9
1006 MOVE: p f6-e5
1007 postauto2
1008 moveindex 10
1009 MOVE: P g2-f2
1010 postauto1
1011 moveindex 11
1012 MOVE: p b6-c5
1013 postauto2
1014 moveindex 12
1015 MOVE: P f3-g4
1016 postauto1
1017 moveindex 13
1018 MOVE: p c5-c3
1019 postauto2
1020 moveindex 14
1021 MOVE: P e3-c3
1022 postauto1
1023 moveindex 15
1024 MOVE: i a8-g2
1025 postauto2
1026 moveindex 16
1027 MOVE: P d3-e2
1028 postauto1
1029 moveindex 17
1030 MOVE: i g2-c6
1031 postauto2
1032 moveindex 18
1033 MOVE: P c3-c5
1034 postauto1
1035 moveindex 19
1036 MOVE: i c6-f3
1037 postauto2
1038 moveindex 20
1039 MOVE: S h1-f3
1040 postauto1
1041 moveindex 21
1042 MOVE: w b8-b4
1043 postauto2
1044 moveindex 22
1045 MOVE: P g4-h3
1046 postauto1
1047 moveindex 23
1048 MOVE: a g8-f7
1049 postauto2
1050 moveindex 24
1051 MOVE: P h3-h1
1052 postauto1
1053 moveindex 25
1054 MOVE: w b4-b5
1055 postauto2
1056 moveindex 26
1057 MOVE: A g1-g6
1058 postauto1
1059 moveindex 27
1060 MOVE: l f8-g7
1061 postauto2
1062 moveindex 28
1063 MOVE: A g6-f6
1064 postauto1
1065 moveindex 29
1066 MOVE: p d6-e7
1067 postauto2
1068 moveindex 30
1069 MOVE: L c1-d2
1070 postauto1
1071 moveindex 31
1072 MOVE: l c8-d7
1073 postauto2
1074 moveindex 32
1075 MOVE: I a1-a6
1076 postauto1
1077 moveindex 33
1078 MOVE: a f7-d5
1079 postauto2
1080 moveindex 34
1081 MOVE: I a6-d6
1082 postauto1
1083 moveindex 35
1084 MOVE: l g7-g6
1085 postauto2
1086 moveindex 36
1087 MOVE: A f6-e6
1088 postauto1
1089 moveindex 37
1090 MOVE: l g6-f6
1091 postauto2
1092 moveindex 38
1093 MOVE: P e2-e3
1094 postauto1
1095 moveindex 39
1096 MOVE: p h7-g6
1097 postauto2
1098 moveindex 40
1099 MOVE: L f1-a6
1100 postauto1
1101 moveindex 41
1102 MOVE: p a7-b8
1103 postauto2
1104 moveindex 42
1105 MOVE: P f2-d4
1106 postauto1
1107 moveindex 43
1108 MOVE: l f6-f4
1109 postauto2
1110 moveindex 44
1111 MOVE: P d4-b6
1112 postauto1
1113 moveindex 45
1114 MOVE: @-c7
1115 postauto2
1116 moveindex 46
1117 MOVE: I d6-c7
1118 postauto1
1119 moveindex 47
1120 MOVE: resign
1121 postauto2
1122 end
1123