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

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