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

Syntax Error on line 519

The function 'PAWN' has not been defined. Its arguments are 1

Edit the Settings File for Experiment

For the sake of debugging, here is the full GAME Code program that this error occurred in. The lines have been properly indented to help you spot scope errors.

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

functions

Array ( [friends] => Array ( [0] => cond [1] => #0 [2] => Array ( [0] => onlylower ) [3] => Array ( [0] => onlyupper ) ) [P] => Array ( [0] => cond [1] => #0 [2] => 1 [3] => 16 ) [p] => Array ( [0] => cond [1] => #0 [2] => 32 [3] => 47 ) [K] => Array ( [0] => cond [1] => #0 [2] => 63 [3] => 103 ) [k] => Array ( [0] => cond [1] => #0 [2] => 63 [3] => 103 ) [G] => Array ( [0] => cond [1] => #0 [2] => 122 [3] => 0 ) [g] => Array ( [0] => cond [1] => #0 [2] => 122 [3] => 0 ) [H] => Array ( [0] => cond [1] => #0 [2] => 203 [3] => 0 ) [h] => Array ( [0] => cond [1] => #0 [2] => 203 [3] => 0 ) [S] => Array ( [0] => cond [1] => #0 [2] => 284 [3] => 0 ) [s] => Array ( [0] => cond [1] => #0 [2] => 284 [3] => 0 ) [C] => Array ( [0] => cond [1] => #0 [2] => 365 [3] => 0 ) [c] => Array ( [0] => cond [1] => #0 [2] => 365 [3] => 0 ) )

uservar

Array ( [0] => Array ( [main] => Array ( [pseudo] => 0 [zonal] => 0 [repeats] => 3 [reploses] => 0 [rulemoves] => 100 [resetpieces] => Array ( [0] => P [1] => p ) [staledraw] => 1 [checkrule] => 1 [extinction] => 1 [nullban] => 1 [wroyal] => Array ( [0] => K ) [broyal] => Array ( [0] => k ) [iron] => Array ( ) [protected] => Array ( ) [restricted] => Array ( ) [counterstrike] => Array ( ) [negligible] => Array ( ) [opaque] => Array ( ) [brouhaha] => Array ( ) [imitators] => Array ( ) [inducers] => Array ( ) [shooters] => Array ( ) [morphers] => Array ( ) [promotables] => Array ( [0] => P [1] => p ) [inocheck] => Array ( [0] => K [1] => k ) [conversion] => Array ( ) [method] => 1 [dropdown] => 1 [crappy] => 0 [cap] => Array ( ) [tempiron] => Array ( ) [epsqrs] => 0 [strike] => 0 [traded] => 0 [nopvc] => 0 [toimitate] => p [lastfen] => 0 [epmask] => 4 [ep] => 0 [suicide] => 0 [freedrop] => 0 [converted] => 0 [hist] => zzz,{bird}{wildebeest}{squirrel}{champion}{king}{squirrel}{wildebeest}{bird}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}32{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{BIRD}{WILDEBEEST}{SQUIRREL}{CHAMPION}{KING}{SQUIRREL}{WILDEBEEST}{BIRD} [posvar] => w{bird}{wildebeest}{squirrel}{champion}{king}{squirrel}{wildebeest}{bird}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}32{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{BIRD}{WILDEBEEST}{SQUIRREL}{CHAMPION}{KING}{SQUIRREL}{WILDEBEEST}{BIRD} [w{bird}{wildebeest}{squirrel}{champion}{king}{squirrel}{wildebeest}{bird}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}{pawn}32{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{PAWN}{BIRD}{WILDEBEEST}{SQUIRREL}{CHAMPION}{KING}{SQUIRREL}{WILDEBEEST}{BIRD}] => 1 [legdefs] => Array ( [0] => 0 [1] => 1 [2] => 1 [3] => 0 [4] => 1 [5] => 1 [6] => 1 [7] => 1 [8] => 1 [9] => 1 [10] => 2 [11] => 1 [12] => 1 [13] => -1 [14] => 1 [15] => 2 [16] => 1 [17] => 1 [18] => 0 [19] => 2 [20] => 16577 [21] => 1 [22] => 1 [23] => 1 [24] => 1 [25] => 4 [26] => 1 [27] => 1 [28] => -1 [29] => 1 [30] => 4 [31] => 0 [32] => 1 [33] => 1 [34] => 0 [35] => -1 [36] => 1 [37] => 1 [38] => 1 [39] => -1 [40] => -1 [41] => 2 [42] => 1 [43] => 1 [44] => 1 [45] => -1 [46] => 2 [47] => 1 [48] => 1 [49] => 0 [50] => -2 [51] => 16577 [52] => 1 [53] => 1 [54] => -1 [55] => -1 [56] => 4 [57] => 1 [58] => 1 [59] => 1 [60] => -1 [61] => 4 [62] => 0 [63] => 1 [64] => 1 [65] => 0 [66] => 1 [67] => 3 [68] => 1 [69] => 1 [70] => 1 [71] => 1 [72] => 3 [73] => 1 [74] => 1 [75] => 1 [76] => 0 [77] => 3 [78] => 1 [79] => 1 [80] => 1 [81] => -1 [82] => 3 [83] => 1 [84] => 1 [85] => 0 [86] => -1 [87] => 3 [88] => 1 [89] => 1 [90] => -1 [91] => -1 [92] => 3 [93] => 1 [94] => 1 [95] => -1 [96] => 0 [97] => 3 [98] => 1 [99] => 1 [100] => -1 [101] => 1 [102] => 3 [103] => 2 [104] => 99 [105] => 1 [106] => 0 [107] => 72 [108] => 1 [109] => 2 [110] => 0 [111] => 9 [112] => 2 [113] => 99 [114] => -1 [115] => 0 [116] => 72 [117] => 1 [118] => -2 [119] => 0 [120] => 9 [121] => 0 [122] => 1 [123] => 1 [124] => 1 [125] => 2 [126] => 3 [127] => 1 [128] => 1 [129] => 2 [130] => 1 [131] => 3 [132] => 1 [133] => 1 [134] => 2 [135] => -1 [136] => 3 [137] => 1 [138] => 1 [139] => 1 [140] => -2 [141] => 3 [142] => 1 [143] => 1 [144] => -1 [145] => -2 [146] => 3 [147] => 1 [148] => 1 [149] => -2 [150] => -1 [151] => 3 [152] => 1 [153] => 1 [154] => -2 [155] => 1 [156] => 3 [157] => 1 [158] => 1 [159] => -1 [160] => 2 [161] => 3 [162] => 1 [163] => 1 [164] => 1 [165] => 3 [166] => 3 [167] => 1 [168] => 1 [169] => 3 [170] => 1 [171] => 3 [172] => 1 [173] => 1 [174] => 3 [175] => -1 [176] => 3 [177] => 1 [178] => 1 [179] => 1 [180] => -3 [181] => 3 [182] => 1 [183] => 1 [184] => -1 [185] => -3 [186] => 3 [187] => 1 [188] => 1 [189] => -3 [190] => -1 [191] => 3 [192] => 1 [193] => 1 [194] => -3 [195] => 1 [196] => 3 [197] => 1 [198] => 1 [199] => -1 [200] => 3 [201] => 3 [202] => 0 [203] => 1 [204] => 1 [205] => 2 [206] => 2 [207] => 3 [208] => 1 [209] => 1 [210] => 2 [211] => -2 [212] => 3 [213] => 1 [214] => 1 [215] => -2 [216] => -2 [217] => 3 [218] => 1 [219] => 1 [220] => -2 [221] => 2 [222] => 3 [223] => 1 [224] => 1 [225] => 0 [226] => 2 [227] => 3 [228] => 1 [229] => 1 [230] => 2 [231] => 0 [232] => 3 [233] => 1 [234] => 1 [235] => 0 [236] => -2 [237] => 3 [238] => 1 [239] => 1 [240] => -2 [241] => 0 [242] => 3 [243] => 1 [244] => 1 [245] => 3 [246] => 3 [247] => 3 [248] => 1 [249] => 1 [250] => 3 [251] => -3 [252] => 3 [253] => 1 [254] => 1 [255] => -3 [256] => -3 [257] => 3 [258] => 1 [259] => 1 [260] => -3 [261] => 3 [262] => 3 [263] => 1 [264] => 1 [265] => 0 [266] => 3 [267] => 3 [268] => 1 [269] => 1 [270] => 3 [271] => 0 [272] => 3 [273] => 1 [274] => 1 [275] => 0 [276] => -3 [277] => 3 [278] => 1 [279] => 1 [280] => -3 [281] => 0 [282] => 3 [283] => 0 [284] => 1 [285] => 1 [286] => 1 [287] => 2 [288] => 3 [289] => 1 [290] => 1 [291] => 2 [292] => 1 [293] => 3 [294] => 1 [295] => 1 [296] => 2 [297] => -1 [298] => 3 [299] => 1 [300] => 1 [301] => 1 [302] => -2 [303] => 3 [304] => 1 [305] => 1 [306] => -1 [307] => -2 [308] => 3 [309] => 1 [310] => 1 [311] => -2 [312] => -1 [313] => 3 [314] => 1 [315] => 1 [316] => -2 [317] => 1 [318] => 3 [319] => 1 [320] => 1 [321] => -1 [322] => 2 [323] => 3 [324] => 1 [325] => 1 [326] => 2 [327] => 2 [328] => 3 [329] => 1 [330] => 1 [331] => 2 [332] => -2 [333] => 3 [334] => 1 [335] => 1 [336] => -2 [337] => -2 [338] => 3 [339] => 1 [340] => 1 [341] => -2 [342] => 2 [343] => 3 [344] => 1 [345] => 1 [346] => 0 [347] => 2 [348] => 3 [349] => 1 [350] => 1 [351] => 2 [352] => 0 [353] => 3 [354] => 1 [355] => 1 [356] => 0 [357] => -2 [358] => 3 [359] => 1 [360] => 1 [361] => -2 [362] => 0 [363] => 3 [364] => 0 [365] => 1 [366] => 1 [367] => 0 [368] => 1 [369] => 3 [370] => 1 [371] => 1 [372] => 1 [373] => 0 [374] => 3 [375] => 1 [376] => 1 [377] => 0 [378] => -1 [379] => 3 [380] => 1 [381] => 1 [382] => -1 [383] => 0 [384] => 3 [385] => 1 [386] => 1 [387] => 2 [388] => 2 [389] => 3 [390] => 1 [391] => 1 [392] => 2 [393] => -2 [394] => 3 [395] => 1 [396] => 1 [397] => -2 [398] => -2 [399] => 3 [400] => 1 [401] => 1 [402] => -2 [403] => 2 [404] => 3 [405] => 1 [406] => 1 [407] => 0 [408] => 2 [409] => 3 [410] => 1 [411] => 1 [412] => 2 [413] => 0 [414] => 3 [415] => 1 [416] => 1 [417] => 0 [418] => -2 [419] => 3 [420] => 1 [421] => 1 [422] => -2 [423] => 0 [424] => 3 [425] => 0 ) [partners] => Array ( [0] => a1 [1] => h1 [2] => a8 [3] => h8 ) [supply] => Array ( [0] => G [1] => g [2] => H [3] => h [4] => S [5] => s [6] => C [7] => c ) [promotab] => Array ( [0] => Array ( [0] => g [1] => h [2] => s [3] => c ) [1] => 0 [2] => 0 [3] => 0 [4] => 0 [5] => 0 [6] => 0 [7] => Array ( [0] => G [1] => H [2] => S [3] => C ) ) [hit] => [royal] => Array ( ) [troy] => Array ( ) [dead] => 0 [RESULT] => [task] => 2 [ltst] => [xtl] => Array ( ) [side] => [ss] => a2 ) ) [1] => Array ( [GameEnd] => Array ( [subargs] => Array ( [0] => true ) [side] => ) [main] => Array ( [player] => true ) ) [3] => Array ( [GenAll] => Array ( [subargs] => Array ( [0] => ) [from] => a2 [piece] => PAWN ) [main] => Array ( [player] => ) ) [5] => Array ( [GenMoves] => Array ( [subargs] => Array ( [0] => PAWN [1] => a2 [2] => 1 ) [index] => 0 [legcount] => 0 [startindex] => 0 ) [main] => Array ( [piece] => PAWN [sqr] => a2 [all] => 1 ) ) )

mline

Array ( [0] => MoveLine Object ( [movenum] => 0 [move] => [level] => 0 [comment] => [length] => 0 [newturn] => [turn] => 0 ) )

allmoves

Array ( )

movelist

constants

Array ( )