Please report any bugs or errors to H.G. Muller

e2 is empty

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 e2-e4 
1... p e7-e5 
2. S f1-c7 //f1-c4-c7
2... s f8-c2 
3. A g1-h3 
3... a c8-d6 
4. A c1-d3 
4... a d6-c7 
5. A d3-c2 
5... a g8-f6 
6. N b1-c3 
6... n h8-g6 
7. N c3-d5 
7... a c7-d5 
8. P e4-d5 
8... s d8-d5 
9. P g2-g3 
9... n b8-c6 
10. S d1-e3 
10... s d5-e3 
11. A c2-e3 
11... n c6-d4 
12. K e1-b1;R a1-c1 
12... a f6-e4 
13. K b1-a1 
13... a e4-d3 
14. N h1-i3 
14... p f7-f5 
15. N i3-h5 
15... k e8-f8 
16. N h5-f4 
16... r i8-h8 
17. N f4-d3 
17... n d4-f3 
18. A h3-f5 
18... n g6-e7 
19. A f5-d7 //Check!
19... k f8-f7 
20. A e3-c4 //Check!
20... resign

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

Here is a code listing:

   0 include /membergraphics/MSgame-code-generation/betza.txt
   1 set legdefs
(0
1  1  0  1     1
1  1  1  1     2
1  1 -1  1     2
1  1  0  2   16577
1  1  1  1     4
1  1 -1  1     4
0
1  1  0 -1     1
1  1 -1 -1     2
1  1  1 -1     2
1  1  0 -2   16577
1  1 -1 -1     4
1  1  1 -1     4
0
1  1  1  2     3
1  1  2  1     3
1  1  2 -1     3
1  1  1 -2     3
1  1 -1 -2     3
1  1 -2 -1     3
1  1 -2  1     3
1  1 -1  2     3
0
1 99  0  1     3
1 99  1  0     3
1 99  0 -1     3
1 99 -1  0     3
0
1  1  0  1     3
1  1  1  1     3
1  1  1  0     3
1  1  1 -1     3
1  1  0 -1     3
1  1 -1 -1     3
1  1 -1  0     3
1  1 -1  1     3
2 99  1  0    72
1  3  0     9
2 99 -1  0    72
1 -3  0     9
0
1 99  1  1     3
1 99  1 -1     3
1 99 -1 -1     3
1 99 -1  1     3
1  1  1  2     3
1  1  2  1     3
1  1  2 -1     3
1  1  1 -2     3
1  1 -1 -2     3
1  1 -2 -1     3
1  1 -2  1     3
1  1 -1  2     3
0
2 99  0  1     1
99  1  1   32771
2 99  1  1     1
99  1  0   32771
2 99  1  0     1
99  1 -1   32771
2 99  1 -1     1
99  0 -1   32771
2 99  0 -1     1
99 -1 -1   32771
2 99 -1 -1     1
99 -1  0   32771
2 99 -1  0     1
99 -1  1   32771
2 99 -1  1     1
99  0  1   32771
2 99  0  1     1
99  1 -1   32771
2 99  1  1     1
99  0 -1   32771
2 99  1  0     1
99 -1 -1   32771
2 99  1 -1     1
99 -1  0   32771
2 99  0 -1     1
99 -1  1   32771
2 99 -1 -1     1
99  0  1   32771
2 99 -1  0     1
99  1  1   32771
2 99 -1  1     1
99  1  0   32771
2 99  0  1     1
99 -1 -1   32771
2 99  1  1     1
99 -1  0   32771
2 99  1  0     1
99 -1  1   32771
2 99  1 -1     1
99  0  1   32771
2 99  0 -1     1
99  1  1   32771
2 99 -1 -1     1
99  1  0   32771
2 99 -1  0     1
99  1 -1   32771
2 99 -1  1     1
99  0 -1   32771
2 99  0  1     1
99 -1  1   32771
2 99  1  1     1
99  0  1   32771
2 99  1  0     1
99  1  1   32771
2 99  1 -1     1
99  1  0   32771
2 99  0 -1     1
99  1 -1   32771
2 99 -1 -1     1
99  0 -1   32771
2 99 -1  0     1
99 -1 -1   32771
2 99 -1  1     1
99 -1  0   32771
0)
   2 def P cond #0 1 16
   3 def p cond #0 32 47
   4 def N cond #0 63 0
   5 def n cond #0 63 0
   6 def R cond #0 104 0
   7 def r cond #0 104 0
   8 def K cond #0 125 165
   9 def k cond #0 125 165
  10 def A cond #0 184 0
  11 def a cond #0 184 0
  12 def S cond #0 245 0
  13 def s cond #0 245 0
  14 set extinction 1
  15 set partners (a1 i1 a8 i8)
  16 set promotables (P p)
  17 set supply (N n R r A a S s)
  18 set promotab (
(n r a s)
0
0
0
0
0
0
(N R A S)
)
  19 set mypieces assoc
P "wpawn.gif" p "bpawn.gif"
N "wknight.gif" n "bknight.gif"
B "wbishop.gif" b "bbishop.gif"
R "wrook.gif" r "brook.gif"
K "wking.gif" k "bking.gif"
A "wcardinal.gif" a "bcardinal.gif"
S "../alfaeriemisc/lavallee/wsissa2.gif" s
"../alfaeriemisc/lavallee/bsissa2.gif"
  20 setsystem dir "/graphics.dir/alfaerie/"
  21 setsystem pieces #mypieces
  22 sub postauto1
  23   gosub HandleMove false
  24 endsub
  25 sub postauto2
  26   gosub HandleMove true
  27 endsub
  28 moveindex 0
  29 MOVE: P e2-e4
  30 postauto1
  31 moveindex 1
  32 MOVE: p e7-e5
  33 postauto2
  34 moveindex 2
  35 MOVE: S f1-c7
  36 postauto1
  37 moveindex 3
  38 MOVE: s f8-c2
  39 postauto2
  40 moveindex 4
  41 MOVE: A g1-h3
  42 postauto1
  43 moveindex 5
  44 MOVE: a c8-d6
  45 postauto2
  46 moveindex 6
  47 MOVE: A c1-d3
  48 postauto1
  49 moveindex 7
  50 MOVE: a d6-c7
  51 postauto2
  52 moveindex 8
  53 MOVE: A d3-c2
  54 postauto1
  55 moveindex 9
  56 MOVE: a g8-f6
  57 postauto2
  58 moveindex 10
  59 MOVE: N b1-c3
  60 postauto1
  61 moveindex 11
  62 MOVE: n h8-g6
  63 postauto2
  64 moveindex 12
  65 MOVE: N c3-d5
  66 postauto1
  67 moveindex 13
  68 MOVE: a c7-d5
  69 postauto2
  70 moveindex 14
  71 MOVE: P e4-d5
  72 postauto1
  73 moveindex 15
  74 MOVE: s d8-d5
  75 postauto2
  76 moveindex 16
  77 MOVE: P g2-g3
  78 postauto1
  79 moveindex 17
  80 MOVE: n b8-c6
  81 postauto2
  82 moveindex 18
  83 MOVE: S d1-e3
  84 postauto1
  85 moveindex 19
  86 MOVE: s d5-e3
  87 postauto2
  88 moveindex 20
  89 MOVE: A c2-e3
  90 postauto1
  91 moveindex 21
  92 MOVE: n c6-d4
  93 postauto2
  94 moveindex 22
  95 MOVE: K e1-b1
  96 MOVE: R a1-c1
  97 postauto1
  98 moveindex 23
  99 MOVE: a f6-e4
 100 postauto2
 101 moveindex 24
 102 MOVE: K b1-a1
 103 postauto1
 104 moveindex 25
 105 MOVE: a e4-d3
 106 postauto2
 107 moveindex 26
 108 MOVE: N h1-i3
 109 postauto1
 110 moveindex 27
 111 MOVE: p f7-f5
 112 postauto2
 113 moveindex 28
 114 MOVE: N i3-h5
 115 postauto1
 116 moveindex 29
 117 MOVE: k e8-f8
 118 postauto2
 119 moveindex 30
 120 MOVE: N h5-f4
 121 postauto1
 122 moveindex 31
 123 MOVE: r i8-h8
 124 postauto2
 125 moveindex 32
 126 MOVE: N f4-d3
 127 postauto1
 128 moveindex 33
 129 MOVE: n d4-f3
 130 postauto2
 131 moveindex 34
 132 MOVE: A h3-f5
 133 postauto1
 134 moveindex 35
 135 MOVE: n g6-e7
 136 postauto2
 137 moveindex 36
 138 MOVE: A f5-d7
 139 postauto1
 140 moveindex 37
 141 MOVE: k f8-f7
 142 postauto2
 143 moveindex 38
 144 MOVE: A e3-c4
 145 postauto1
 146 moveindex 39
 147 MOVE: resign
 148 postauto2
 149 gosub GameEnd true
 150 end
 151 
 152 lib /membergraphics/MSgame-code-generation/betza.txt
 153 if == thismove null
 154   say This rule-enforcing preset was created through the Play-Test Applet
 155 endif
 156 echo Please report any bugs or errors to H.G. Muller
 157 setsystem maxmove 4
 158 setsystem omitmoves 1
 159 ban commands
 160 allow pass 2 pass 3
 161 set pseudo 0
 162 set zonal 0
 163 set repeats 3
 164 set reploses 0
 165 set rulemoves 100
 166 set resetpieces (P p)
 167 set staledraw 1
 168 set checkrule 1
 169 set extinction 0
 170 set nullban 1
 171 set wroyal (K)
 172 set broyal (k)
 173 set iron array
 174 set protected array
 175 set restricted array
 176 set counterstrike array
 177 set negligible array
 178 set opaque array
 179 set brouhaha array
 180 set imitators array
 181 set inducers array
 182 set shooters array
 183 set morphers array
 184 set promotables array
 185 set inocheck (K k)
 186 set conversion array
 187 set method 1
 188 set dropdown 1
 189 set crappy 0
 190 set cap array
 191 set tempiron array
 192 set epsqrs 0
 193 set strike 0
 194 set traded 0
 195 set nopvc 0
 196 set toimitate p
 197 set lastfen 0
 198 set epmask 4
 199 set many ep 0 suicide 0 freedrop 0
 200 set converted 0
 201 set hist . "zzz," fencode
 202 def friends cond #0 (onlylower) (onlyupper)
 203 sub FastCastle start dx dy
 204   verify not flag #start
 205   my k r sqr cornr rook
 206   set r ray #start #dx #dy
 207   set k dec count #r
 208   set cornr elem #k #r
 209   set rook space #cornr
 210   verify != @ #rook and not flag #cornr
 211   do while #k
 212     dec k
 213     set sqr elem #k #r
 214     if == @ space #sqr
 215       if == 0 #k
 216         set realto #sqr
 217         set sqr #cornr
 218       endif
 219       gosub GotMove #start #sqr #cornr #start #rook 1
 220     endif
 221   loop
 222 endsub
 223 sub Promote player piece desti
 224   my choice r across
 225   verify mln
 226   set r rank #desti
 227   set across - lastrank * 2 #r
 228   if == #player < #across 0
 229     return
 230   endif
 231   if match #piece #promotables
 232     set choice elem #r #promotab
 233     if #choice
 234       if match self #choice
 235         push choice #piece
 236       endif
 237       set cap mergeall #cap #supply
 238       set choice intersection #cap #choice
 239     endif
 240   else
 241     set choice 0
 242   endif
 243   if #promo
 244     if not #choice
 245       die "You cannot promote on this move"
 246     elseif not match #promo #choice
 247       die "You cannot promote to such a piece"
 248     endif
 249   elseif #choice and not $answered
 250     askpromote #choice
 251   endif
 252 endsub
 253 sub GotMove orisqr destsqr locustsqr dropsqr unload implied
 254   if == 2 #zonal
 255     set k space #orisqr
 256     gosub GetMorph #k #destsqr
 257     verify != barred #k
 258   endif
 259   switch #task
 260     case 1
 261     set halfhit or #halfhit and #crappy and == #orisqr #ori == #locustsqr #desti
 262     verify == #orisqr #ori and == #destsqr #desti
 263     if == 1 #zonal
 264       verify not fn BadZone #orisqr #destsqr #locustsqr #dropsqr #unload
 265     endif
 266     if != 1 #implied
 267       if #firstpart
 268         set pseudohit + #pseudohit #crappy
 269         set autolocust #locustsqr
 270         set autodrop #dropsqr
 271         set dropped #unload
 272       endif
 273       if #sideeffect
 274         verify == #sideeffect #dropsqr
or == #sideeffect #locustsqr
 275         set suicide #locustsqr
 276         set freedrop #dropsqr
 277         set dropped #unload
 278       else
 279         verify == #locustsqr #suicide
 280         verify == #dropsqr #freedrop
 281         verify == #unload #dropped or not #dropsqr
 282       endif
 283     else
 284       verify not #suicide and not #freedrop
 285       if #locustsqr
 286         capture #locustsqr
 287         set imp 1
 288       endif
 289       set impliedkill #locustsqr
 290       set implieddrop #dropsqr
 291       set dropped #unload
 292     endif
 293     set neweps #eps
 294     set ep #destsqr
 295     set ok 1
 296     set desc #mv
 297     break
 298     case 2
 299     if == 1 #zonal
 300       verify not fn BadZone #orisqr #destsqr #locustsqr #dropsqr #unload
 301     endif
 302     if #locustsqr or #dropsqr and #dropdown and not #implied
 303       set m . space #orisqr . ws . #orisqr . chr 45 . #destsqr . chr 59 ws
 304       if #locustsqr
 305         set m . #m . "@-" #locustsqr
 306       elseif #dropsqr
 307         set m . #m . #unload . chr 45 #dropsqr
 308       endif
 309       push xtl #m
 310     else
 311       setlegal #orisqr #destsqr
 312     endif
 313     break
 314     case 9
 315     if == #locustsqr #kpos
 316       push checks #ss
 317       push checks #mv
 318       setelem #locustsqr 0 1
 319     endif
 320     break
 321     case 10
 322     case 7
 323     case 3
 324     set hit cond match space #destsqr #royal #orisqr #hit
 325     if != Xdummy space #locustsqr and #locustsqr
 326       set hit cond match space #locustsqr #royal Ughh #hit
 327     endif
 328     break
 329     case 12
 330     verify count var #orisqr
 331     case 11
 332     if & 1 elem 0 var #destsqr
and == #orisqr #kpos
 333       break
 334     endif
 335     case 4
 336     case 8
 337     if == 1 #zonal
 338       verify not fn BadZone #orisqr #destsqr #locustsqr #dropsqr #unload
 339     endif
 340     my victim locustvictim
 341     set victim space #destsqr
 342     set locustvictim space #locustsqr
 343     if #locustsqr
 344       empty #locustsqr
 345     endif
 346     move #orisqr #destsqr
 347     if #dropsqr
 348       add #unload #dropsqr
 349     endif
 350     dec task
 351     set hit 0
 352     if == 10 #task
 353       if #checked
 354         gosub GenAttacks checks
 355       endif
 356       gosub GenAttacks #orisqr
 357       gosub GenAttacks #destsqr
 358       if #locustsqr
 359         gosub GenAttacks #locustsqr
 360       endif
 361       if #dropsqr
 362         gosub GenAttacks #dropsqr
 363       endif
 364     else
 365       if #threat and != #threat Ughh
 366         set checker space #threat
 367         if cond #xside islower #checker isupper #checker
 368           gosub GenMoves #checker #threat 1
 369         endif
 370       endif
 371       if not #hit
 372         gosub GenAll #xside
 373       endif
 374     endif
 375     inc task
 376     move #destsqr #orisqr
 377     if != #dropsqr #orisqr and #dropsqr
 378       empty #dropsqr
 379     endif
 380     if #locustsqr
 381       add #locustvictim #locustsqr
 382     endif
 383     add #victim #destsqr
 384     if == 4 #task
 385       set threat #hit
 386       set hit not #hit
 387     elseif #hit
 388       set hit 0
 389     elseif #locustsqr or #dropsqr and #dropdown and not #implied
 390       set m . space #orisqr . ws . #orisqr . chr 45 . #destsqr . chr 59 ws
 391       if #locustsqr
 392         if match #mover #shooters
 393           set m . #m . "@-" #locustsqr
 394         else
 395           set m . space #orisqr . ws . #orisqr . chr 45 . #locustsqr . chr 59 ws
 396           set m . #m . space #orisqr . ws . #locustsqr . chr 45 #destsqr
 397         endif
 398       elseif #dropsqr
 399         set m . #m . #unload . chr 45 #dropsqr
 400       endif
 401       push xtl #m
 402     else
 403       setlegal #orisqr #destsqr
 404     endif
 405     break
 406     case 5
 407     verify == #locustsqr #desti
 408     setlegal #locustsqr #destsqr
 409     break
 410     case 6
 411     verify == #ori #orisqr and == #desti #destsqr
 412     if #dropsqr
 413       setlegal #desti #dropsqr
 414     elseif #locustsqr
 415       setlegal #desti #locustsqr
 416     endif
 417     break
 418     case 13
 419     verify not #dropsqr and #locustsqr or not empty #destsqr
 420     set hit 1
 421     break
 422   endswitch
 423 endsub
 424 sub NextLeg togo legindex startsqr cursqr locustsqr dropsqr iso
 425   my rng dx dy mode to tosqrs k len newindex hx hy side r fratricide stopper
 426   set rng elem #legindex #legdefs
 427   set dx elem + 1 #legindex #legdefs
 428   set dy elem + 2 #legindex #legdefs
 429   set mode elem + 3 #legindex #legdefs
 430   if & 64 #mode
 431     verify not flag #startsqr
 432     if match space #startsqr #inocheck
 433       verify != #task 11 or not #checked
 434       push eps #startsqr
 435     endif
 436   endif
 437   if > 0 #rng
 438     switch #rng
 439       case -1
 440       set rng cond < 0 #dy rank #cursqr - lastrank rank #cursqr
 441       set rng - >> lastrank 1 #rng
 442       set rng max 1 #rng
 443       set eps array
 444       set mode | << 1 23 #mode
 445       break
 446       case -2
 447       gosub GenMoves #toimitate #startsqr 1
 448       return
 449       case -3
 450       gosub #mode #startsqr #dx #dy
 451       return
 452     endswitch
 453   endif
 454   set tosqrs ride #cursqr #dx #dy
 455   set r count #tosqrs
 456   if not #r
 457     if & #mode << 1 27
 458       gosub GotMove #startsqr #cursqr #locustsqr #dropsqr 0 0
 459     else
 460       return
 461     endif
 462   endif
 463   set r min #rng #r
 464   if & 128 #mode
 465     set hx >> + 8 * 5 #dx 4
 466     set hy >> + 8 * 5 #dy 4
 467     set k ride #startsqr #hx #hy
 468     set len count #k
 469     set len * #len + abs #hx abs #hy
 470     set len / #len + abs #dx abs #dy
 471     if < #len #r
 472       set r #len
 473       if == 9 #task
 474         pop k to
 475         push #to #ss
 476         push #to #mv
 477       endif
 478     endif
 479     verify #len
 480     if & << 1 14 #mode
 481       set eps array
 482       set to where #cursqr #dx #dy
 483       set k #cursqr
 484       do while != #to #k and onboard #k
 485         set k where #k #hx #hy
 486         if != #k #to
 487           push eps #k
 488         endif
 489       loop
 490     endif
 491   endif
 492   dec togo
 493   if & << 1 21 #mode
 494     set dropsqr #cursqr
 495   endif
 496   if & << 1 15 #mode
 497     verify >= #r #iso
 498     set r #iso
 499   elseif < 1 #r
 500     if & 1 #mode
 501       set k 1
 502       do while < #k #r
 503         set to elem dec #k #tosqrs
 504         if #togo
 505           set newindex + 4 #legindex
 506           gosub NextLeg #togo #newindex #startsqr #to #locustsqr #dropsqr #k
 507         else
 508           gosub GotMove #startsqr #to #locustsqr #dropsqr 0 0
 509         endif
 510         if & << 1 23 #mode
 511           push eps #to
 512         endif
 513         inc k
 514         verify not #hit
 515       loop
 516     endif
 517     if & #epmask #mode
 518       set k 1
 519       do while < #k #r
 520         set to elem dec #k #tosqrs
 521         if match #to #epsqrs
 522           if #togo
 523             set newindex + 4 #legindex
 524             gosub NextLeg #togo #newindex #startsqr #to #ep #dropsqr #k
 525           else
 526             gosub GotMove #startsqr #to #ep #dropsqr 0 1
 527           endif
 528         endif
 529         inc k
 530       loop
 531     endif
 532     if & 18 #mode and == 9 #task
 533       set k 1
 534       do while < #k #r
 535         set to elem dec #k #tosqrs
 536         if #togo
 537           push #to #ss
 538           push #to #mv
 539         endif
 540         if & 2 #mode
 541           if #togo
 542             if == #to #kpos
 543               set newindex + 4 #legindex
 544               gosub NextLeg #togo #newindex #startsqr #to #to #dropsqr #k
 545             endif
 546           else
 547             setelem #to 0 | 1 elem 0 var #to
 548             if == #to #kpos
 549               push checks #ss
 550               push checks #mv
 551             endif
 552           endif
 553         endif
 554         inc k
 555       loop
 556     endif
 557   endif
 558   set len cond == 1 #rng #iso #r
 559   set to elem dec #r #tosqrs
 560   if == 9 #task
 561     if cond empty #to
(& 18 #mode and #togo)
(not & << 1 15 #mode and
!= #r #rng and
or & 2 #mode #togo or
and & 1 #mode
#togo)
 562       push #to #ss
 563       push #to #mv
 564     endif
 565     if & + 2 << 1 13 #mode and == #to #kpos
 566       if #togo
 567         set newindex + 4 #legindex
 568         gosub NextLeg #togo #newindex #startsqr #to #to #dropsqr #len
 569       else
 570         push checks #ss
 571         push checks #mv
 572       endif
 573     endif
 574     if & 2 #mode and not #togo
 575       setelem #to 0 | 1 elem 0 var #to
 576     endif
 577   endif
 578   if match #to #epsqrs and & #epmask #mode
 579     if #togo
 580       set newindex + 4 #legindex
 581       gosub NextLeg #togo #newindex #startsqr #to #ep #dropsqr #len
 582     else
 583       gosub GotMove #startsqr #to #ep 0 0 1
 584     endif
 585   endif
 586   set stopper cond != #to #startsqr space #to @
 587   if == @ #stopper
 588     verify & 1 #mode
 589   else
 590     if & 16 #mode
 591       if not match #stopper #opaque or
not match space #startsqr #opaque
 592         set newindex + 4 #legindex
 593         gosub NextLeg #togo #newindex #startsqr #to #locustsqr #dropsqr #len
 594       endif
 595     endif
 596     set side islower space #startsqr
 597     set fratricide cond #side islower #stopper isupper #stopper
 598     if #fratricide
 599       if & 8 #mode
 600         verify match #to #partners
 601         verify not flag #to
 602         set locustsqr #to
 603         set to where #startsqr elem + 5 #legindex #legdefs 0
 604         set dropsqr where #to - 0 #dx #dy
 605         set eps array
 606         set k #startsqr
 607         do while != #k #to
 608           push eps #k
 609           set k where #k #dx 0
 610         loop
 611         set realto #to
 612         gosub GotMove #startsqr #to #locustsqr #dropsqr #stopper 1
 613         return
 614       elseif & 2048 #mode
 615         if #togo
 616           set newindex + 4 #legindex
 617           gosub NextLeg #togo #newindex #to #to 0 0 #len
 618         elseif != #stopper space #startsqr
 619           gosub GenMoves #stopper #startsqr 1
 620         endif
 621       endif
 622       verify & 4096 #mode
 623     else
 624       verify match #stopper #royal and
& << 1 13 #mode or & 2 #mode
 625       verify not match #stopper #tempiron
 626     endif
 627     if #togo
 628       set locustsqr #to
 629     endif
 630   endif
 631   if #togo
 632     set newindex + 4 #legindex
 633     gosub NextLeg #togo #newindex #startsqr #to #locustsqr #dropsqr #len
 634   else
 635     gosub GotMove #startsqr #to #locustsqr #dropsqr #stopper 0
 636   endif
 637 endsub
 638 sub GenMoves piece sqr all
 639   my index legcount startindex
 640   set side islower #piece
 641   set ss #sqr
 642   set index fn #piece #all
 643   do
 644     set legcount elem #index #legdefs
 645     verify #legcount
 646     set mv #index
 647     inc index
 648     if flag #sqr or not match #piece #conversion
or not & cond #side #converted << #converted 2
+ 64 & 64 elem + 3 #index #legdefs
 649       set eps 0
 650       gosub NextLeg #legcount #index #sqr #sqr 0 0 1
 651     endif
 652     set index + #index * 4 #legcount
 653   loop until #hit
 654 endsub
 655 sub GenAttacks sqr
 656   my k n togo leg piece
 657   set k 1
 658   set n count var #sqr
 659   do while < #k #n
 660     set start elem #k var #sqr
 661     inc k
 662     set leg elem #k var #sqr
 663     inc k
 664     set piece space #start
 665     if not cond #xside
(islower #piece)
(isupper #piece)
 666       continue
 667     endif
 668     set togo elem #leg #legdefs
 669     inc leg
 670     gosub NextLeg #togo #leg #start #start 0 0 1
 671   loop
 672 endsub
 673 sub GenAll player
 674   my from piece
 675   set hit false
 676   for (from piece) fn friends #player
 677     gosub GenMoves #piece #from 1
 678     verify not #hit
 679   next
 680 endsub
 681 sub GetRoyals player
 682   my i nr type myroyal cnt
 683   set myroyal cond #player (#broyal) (#wroyal)
 684   set many i 0 nr 0 hit 0
 685   set royal array
 686   set troy array
 687   do while < #i count #myroyal
 688     set type elem #i #myroyal
 689     set cnt elem #type piececount
 690     if + 0 #cnt
 691       set nr + #nr #cnt
 692       push royal #type
 693       push troy #cnt
 694     endif
 695     inc i
 696   loop
 697   set dead count #royal and not #nr
 698   if < 1 #nr and #extinction
 699     set royal array
 700   endif
 701 endsub
 702 sub InCheck player
 703   GetRoyals #player
 704   set task 3
 705   verify count #royal
 706   if #traded
 707     add Xdummy #desti
 708     push royal Xdummy
 709   endif
 710   if count #epsqrs and
match space #ep #royal
 711     set epmask 6
 712   endif
 713   set player not #player
 714   gosub GenAll #player
 715   set epmask 4
 716   if #traded
 717     add #traded #desti
 718   endif
 719 endsub
 720 sub ParseMove player
 721   my i j parts sqrs sqr
 722   set many suicide 0 freedrop 0 promo 0 sideeffect 0
 723   set mvs explode chr 59 thismove
 724   set parts explode ws trim elem 0 #mvs
 725   set i count #parts
 726   if > #i 2
 727     die "move must be piece ID plus board step"
 728   endif
 729   set sqrs explode chr 45 trim elem dec #i #parts
 730   if != 2 count #sqrs
 731     if == resign thismove
 732       resign
 733     elseif == drawn thismove
 734       drawn
 735     endif
 736     die "board step does not mention two squares"
 737   endif
 738   set ori elem 0 #sqrs
 739   set desti elem 1 #sqrs
 740   if not onboard #desti
 741     set msg join #desti " is not a valid square"
 742     die #msg
 743   endif
 744   if not onboard #ori
 745     set msg join #ori " is not a valid square"
 746     die #msg
 747   endif
 748   set mover space #ori
 749   if not cond #player islower #mover isupper #mover
 750     set msg cond == @ #mover (. #ori " is empty")
("you cannot move opponent pieces")
 751     die #msg
 752   endif
 753   set firstpart 1
 754   set j 1
 755   do while < #j count #mvs
 756     set parts trim elem #j #mvs
 757     if == "pass" #parts or == "skip" #parts
 758       set firstpart 0
 759       inc j
 760       continue
 761     endif
 762     set parts explode ws trim #parts
 763     set i dec count #parts
 764     set sqrs explode chr 45 trim elem #i #parts
 765     if != 2 count #sqrs
 766       set msg join elem #i #parts " is malformed"
 767       die #msg
 768     endif
 769     set sqr elem 1 #sqrs
 770     set sqr cond == "dest" #sqr #desti #sqr
 771     if not onboard #sqr
 772       set msg join #sqr " is not a valid square"
 773       die #msg
 774     elseif onboard elem 0 #sqrs
 775       if != #desti elem 0 #sqrs
 776         die "you can only continue with same piece"
 777       endif
 778       set firstpart 0
 779       if match #mover #shooters
 780         set sideeffect #sqr
 781         return
 782       endif
 783       if #suicide
 784         die "cannot have more than one locust victim"
 785       endif
 786       set suicide #desti
 787       set desti #sqr
 788     elseif == #desti #sqr
 789       set promo elem 0 #sqrs
 790     elseif == @ elem 0 #sqrs
 791       if empty #sqr
 792         set msg . "there is nothing on " . #sqr " to capture"
 793         die #msg
 794       endif
 795       if #suicide
 796         die "cannot have more than one locust victim"
 797       endif
 798       set suicide #sqr
 799       set firstpart 0
 800     else
 801       if #freedrop
 802         die "cannot kick more than one piece"
 803       endif
 804       set dropped elem 0 #sqrs
 805       set freedrop #sqr
 806       set firstpart 0
 807     endif
 808     inc j
 809   loop
 810 endsub
 811 sub HandleMove player
 812   set stm #player
 813   gosub ParseMove #player
 814   set all == mln $maxmln
 815   set many ok 0 hit 0 task 1 halfhit 0 implieddrop 0 imp 0 neweps 0
 816   set pseudohit 0
 817   set realto 0
 818   set k #all or not flag #ori and match #mover #conversion
 819   gosub GenMoves #mover #ori #k
 820   if not match #mover #shooters
and #firstpart and #halfhit
 821     set ok 2
 822     set task 5
 823     gosub GenMoves #mover #ori 1
 824     set msg . "Enter second leg or pass"
 825     remind #msg
 826   elseif #all
 827     set cap unique keys capturedpieces
 828     set lastfen fencode
 829     if not #ok
 830       set pseudohit 0
 831       gosub GenAll #player
 832     endif
 833     if #sideeffect
 834       rewritemove . elem 0 #mvs . "; " . cond #freedrop #dropped @ . chr 45 #sideeffect
 835       set sideeffect 0
 836       gosub ParseMove #player
 837     endif
 838     if match #mover #shooters and < 1 #pseudohit
 839       set ok 2
 840       set task 6
 841       gosub GenAll #player
 842       if #hit
 843         set msg . "Type side effect of move, or pass"
 844       else
 845         set msg . "Type side effect of move"
 846       endif
 847       remind #msg
 848     elseif not #ok
 849       if == 1 #pseudohit
 850         if #autolocust
 851           appendmove join "@-" #autolocust
 852         endif
 853         if #autodrop
 854           appendmove join #dropped join chr 45 #autodrop
 855         endif
 856         gosub ParseMove #player
 857       elseif #pseudohit
 858         set msg . "Type side effects of move"
 859         remind #msg
 860         continuemove
 861         return
 862       else
 863         set msg . thismove . " is not even pseudo-legal for a " toupper #mover
 864         die #msg
 865       endif
 866     endif
 867   endif
 868   set victim cond != #desti #ori space #desti @
 869   set traded cond and or match space #suicide #negligible
not #suicide
and match #victim #protected
match #mover #restricted #mover 0
 870   set strike and match #victim #counterstrike
not match #mover #counterstrike
 871   set k 0
 872   do while < var k count var mvs
 873     eval join "MOVE: " trim elem var k var mvs
 874     inc k
 875   loop
 876   if != #ori #freedrop and match #ori #brouhaha
 877     delete #ori
 878   endif
 879   if #implieddrop
 880     add #dropped #implieddrop
 881     if == #desti #impliedkill
 882       move #desti #realto
 883     endif
 884   endif
 885   set tempiron #iron
 886   if #strike
 887     set tempiron mergeall #tempiron #counterstrike
 888   endif
 889   set toimitate flipcase cond match #mover #imitators #toimitate #mover
 890   setflag #desti
 891   set posvar join cond #player "w" "b" fencode
 892   inc #posvar
 893   inc nopvc
 894   if #imp
 895     set hist . #hist . "," mln
 896   endif
 897   if #suicide and not #freedrop or #promo
or != @ #victim or match #mover #resetpieces
 898     set nopvc 0
 899   endif
 900   set epsqrs #neweps
 901   if not flag #ori and match #mover #conversion
 902     set k + 64 & 64 elem + 4 #desc #legdefs
 903     set k cond #player #k >> #k 2
 904     if & #k #converted
 905       die This move violates the conversion rule that applies to this piece.
 906     endif
 907     set converted + #converted #k
 908   endif
 909   gosub GetMorph #mover #desti
 910   if #k
 911     add #k #desti
 912   endif
 913 endsub
 914 sub GetMorph piece sqr
 915   set k 0
 916   if match #piece #morphers
 917     set i elem #piece #morphs
 918     set j rank #sqr
 919     if not islower #piece
 920       set j - lastrank #j
 921     endif
 922     if >= #j count #i
 923       return
 924     endif
 925     set i elem #j #i
 926     if #i
 927       if == All elem 0 #i
 928         set k elem 1 #i
 929       else
 930         set k elem file #sqr #i
 931       endif
 932     endif
 933   endif
 934 endsub
 935 sub GameEnd player
 936   my side
 937   if == 2 #ok
 938     continuemove
 939     return
 940   endif
 941   set side not #player
 942   gosub GetRoyals #side
 943   if #dead
 944     set msg join cond #player "White" "Black" " lost by absence of royalty!"
 945     say #msg
 946     won
 947   elseif == #lastfen fencode and #nullban
 948     die "This is a null move!"
 949   endif
 950   gosub InCheck #player
 951   if == #hit Xdummy
 952     die "Trading of this piece is not allowed"
 953   elseif #checkrule and #hit
 954     if == #hit Ughh
 955       die "That moves through or out of check"
 956     else
 957       die "This exposes your royal piece to capture"
 958     endif
 959   endif
 960   if >= 1 count fn friends #player and #baring
 961     if >= 1 count fn friends #side
 962       say Draw by mutual baring
 963       drawn
 964     else
 965       set msg . cond #player "Black" "White" " loses by baring"
 966       say #msg
 967       lost
 968     endif
 969     return
 970   endif
 971   gosub Promote #player #mover #desti
 972   gosub GetRoyals #side
 973   if count #royal
and #checkrule
 974     set task 4
 975     set xside #player
 976     set threat 0
 977     gosub GenAll #side
 978     if not #hit
 979       if #staledraw
 980         dec task
 981         gosub GenAll #player
 982         if #hit
 983           say Checkmate!
 984           won
 985         else
 986           say Stalemate!
 987           drawn
 988         endif
 989       else
 990         say Mate!
 991         won
 992       endif
 993       return
 994     endif
 995   endif
 996   set posvar join cond #player "w" "b" fencode
 997   if >= var #posvar #repeats
 998     if #reploses
 999       set msg join cond #player "Black" "White" " loses by repetition!"
1000       say #msg
1001       lost
1002     else
1003       say "Draw by repetition!"
1004       drawn
1005     endif
1006   elseif >= #nopvc #rulemoves
1007     say "Game declared draw due to prolongued lack of progress!"
1008     drawn
1009   endif
1010   set ltst #checkrule and count #royal and not #pseudo
1011   set xtl array
1012   if == 1 #method and #ltst
1013     for sqr spaces
1014       set #sqr array 0
1015     next
1016     set task 9
1017     set king elem 0 #royal
1018     set kpos search #king $space
1019     empty #kpos
1020     set checks array 0
1021     gosub GenAll #player
1022     add #king #kpos
1023     set checked & 1 elem 0 var #kpos
1024     if #checked
1025       say "check!"
1026     endif
1027     set task 11
1028     gosub GenAll #side
1029   else
1030     set task cond #ltst 8 2
1031     gosub GenAll #side
1032   endif
1033   setjsvar impmoves #hist
1034   setsystem legalmoves merge $legalmoves #xtl
1035 endsub
1036 set posvar join "w" fencode
1037 inc #posvar
1038 endlib