Syntax Error on line 62
An endsub
has appeared outside of a subroutine definition.
Edit the Settings File for Ajax Orthodox Chess
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 echo This preset uses the code for identifying check, checkmate, and stalemate. 1 setflag a1 a8 h1 h8 e1 e8 2 set k e8 3 set K e1 4 set ep false 5 include chess2 6 allow moves 1 captures 1 moves 2 promotions 2 moves 3 7 alias M _MLV_SI m _mlv_si 8 def Q checkride #0 #1 1 1 or checkride #0 #1 1 0 9 def q checkride #0 #1 1 1 or checkride #0 #1 1 0 10 def _MLV_SI or #1==W3 or #1==W4 or #1==a1 or #1==b1 or #1==c1 or #1==d1 or #1==e1 or #1==f1 or #1==g1 or #1==h1 and (or #0==W1 #0==W2)or checkleap #0 #1 1 1 or checkleap #0 #1 1 0 or checkleap #0 #1 2 2 or checkleap #0 #1 2 0 11 def _mlv_si or #1==B6 or #1==B5 or #1==a8 or #1==b8 or #1==c8 or #1==d8 or #1==e8 or #1==f8 or #1==g8 or #1==h8 and (or #0==B7 #0==B8)or checkleap #0 #1 1 1 or checkleap #0 #1 1 0 or checkleap #0 #1 2 2 or checkleap #0 #1 2 0 12 def B checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 1 13 def b checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 1 14 def R checkleap #0 #1 1 1 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 0 15 def N checkleap #0 #1 1 1 or checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkleap #0 #1 1 2 16 def n checkleap #0 #1 1 1 or checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkleap #0 #1 1 2 17 def _MLV_SIL merge merge leaps #0 1 0 leaps #0 1 1 merge leaps #0 2 0 leaps #0 2 2 def _mlv_siL merge merge leaps #0 1 0 leaps #0 1 1 merge leaps #0 2 0 leaps #0 2 2 sub castle 18 local c RPOS RDEST xdir 19 if not flag #from 20 die A King may not castle after it moves. 21 endif 22 if capture 23 die A King may not castle to an occupied space. 24 endif 25 set xdir sign minus file #to file #from 26 if not checkaride #from #to #xdir 0 27 die A King may not castle across any occupied space. 28 endif 29 set c #to 30 do 31 set c where #c #xdir 0 32 if flag #c 33 break 34 elseif not onboard #c 35 die No piece was found to castle with. 36 elseif not empty #c 37 die The King cannot castle with the piece at #c 38 endif 39 loop 40 set RPOS #c 41 move #to #from 42 if sub checked #from 43 die A King may not castle out of check. 44 endif 45 store 46 for c path #from #to 47 move #from #c 48 if sub checked #c 49 die A King may not castle through check. 50 endif 51 restore 52 next 53 move #from #to 54 if == count var subargs 0 55 set RDEST where #to neg #xdir 0 56 else 57 set RDEST elem 0 subargs 58 endif 59 unsetflag #RPOS 60 move #RPOS #RDEST 61 return true WarningThe scope has gone below the base level.
62 endsub WarningThe scope has gone below the base level.
63 sub postauto1 64 if isupper old 65 die You may not capture your own pieces. 66 endif 67 if not equal moved P 68 set ep false 69 if unequal space dest moved 70 die You may not change the type of this piece. 71 endif 72 endif 73 set legal false 74 if match moved P K 75 gosub moved origin dest 76 if equal moved K 77 set K dest 78 endif 79 elseif match moved Q R B N _MLV_SI 80 set legal fn moved origin dest 81 if == moved R 82 unsetflag origin 83 else 84 unsetflag dest 85 endif 86 elseif islower moved 87 die You may not move one of your opponent's pieces. 88 endif 89 if not var legal 90 die You may not move a moved from origin to dest 91 endif 92 if sub checked #K 93 die You may not move into check. 94 endif WarningThe scope has gone below the base level.
95 endsub WarningThe scope has gone below the base level.
96 sub postauto2 97 if islower old 98 die You may not capture your own pieces. 99 endif 100 if not equal moved p 101 set ep false 102 if unequal space dest moved 103 die You may not change the type of this piece. 104 endif 105 endif 106 set legal false 107 if match moved p k 108 gosub moved origin dest 109 if equal moved k 110 set k dest 111 endif 112 elseif match moved q r b n _MLV_si 113 set legal fn moved origin dest 114 if == moved r 115 unsetflag origin 116 else 117 unsetflag dest 118 endif 119 elseif isupper moved 120 die You may not move one of your opponent's pieces. 121 endif 122 if not var legal 123 die You may not move a moved from origin to dest 124 endif 125 if sub checked #k 126 die You may not move into check. 127 endif WarningThe scope has gone below the base level.
128 endsub WarningThe scope has gone below the base level.
129 if sub checked #K 130 if sub stalemated #K 131 say Checkmate! Black has won! 132 won 133 else 134 say Check! 135 endif WarningThe scope has gone below the base level.
136 elseif sub stalemated #K 137 say Stalemate! The game is drawn. 138 drawn WarningThe scope has gone below the base level.
139 endif WarningThe scope has gone below the base level.
140 end WarningThe scope has gone below the base level.
141functions
uservar
Array ( [0] => Array ( [main] => Array ( ) ) )mline
Array ( [0] => MoveLine Object ( [movenum] => 0 [move] => [level] => 0 [comment] => [length] => 0 [newturn] => [turn] => 0 ) )allmoves
Array ( )movelist
constants
Array ( )