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

Syntax Error on line 313

Missing both default and case "#rng" in switch

Edit the Settings File for Chess on the Rope 15x1

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

mline

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

allmoves

Array ( )

movelist

constants

Array ( )