Syntax Error on line 92
checks is not the name of any known subroutine in your program
Edit the Settings File for Cetran Chess 2
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 if not isconst firstrank 1 drop K any a1 b1 c1 d1 e1 f1 g1 h1 2 drop _MLV_SI any a1 b1 c1 d1 e1 f1 g1 h1 3 drop Q any a1 b1 c1 d1 e1 f1 g1 h1 4 drop M any a1 b1 c1 d1 e1 f1 g1 h1 5 drop R any a1 b1 c1 d1 e1 f1 g1 h1 6 drop N any a1 b1 c1 d1 e1 f1 g1 h1 7 drop A any a1 b1 c1 d1 e1 f1 g1 h1 8 drop .BW any a1 b1 c1 d1 e1 f1 g1 h1 9 set fr null 10 for i range a h 11 set fr join var fr space join var i 1 12 next 13 setconst firstrank var fr 14 else 15 for i range 0 7 16 set c join chr + 97 var i 1 17 set p substr const firstrank var i 1 18 add #p #c 19 next 20 endif 21 def .BW checkride #0 #1 1 1 or checkleap #0 #1 1 0 22 def .bw checkride #0 #1 1 1 or checkleap #0 #1 1 0 23 def _MLV_SI checkride #0 #1 1 1 and checkride #0 #1 1 0 24 def _mlv_si checkride #0 #1 1 1 and checkride #0 #1 1 0 25 def M fn N #0 #1 or fn R #0 #1 26 def m fn N #0 #1 or fn R #0 #1 27 def A fn N #0 #1 or fn B #0 #1 28 def a fn N #0 #1 or fn B #0 #1 29 copy a1 a8 30 copy b1 b8 31 copy c1 c8 32 copy d1 d8 33 copy e1 e8 34 copy f1 f8 35 copy g1 g8 36 copy h1 h8 37 flip a8 b8 c8 d8 e8 f8 g8 h8 38 alias S _MLV_SI s _mlv_si 39 include chess2 40 sub postauto1 41 if not equal moved P 42 set ep false 43 if unequal space dest moved 44 die You may not change the type of this piece. 45 endif 46 endif 47 set legal false 48 if match moved P K R 49 gosub moved origin dest 50 if equal moved K 51 set K dest 52 endif 53 elseif match moved Q B N 54 set legal fn moved origin dest 55 endif 56 if not var legal 57 die You may not move a moved from origin to dest 58 endif 59 if isupper old 60 die You may not capture your own pieces. 61 endif 62 if fn ATTACKEDBYB #K 63 die You may not move into check. 64 endif 65 endsub 66 sub postauto2 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 r 75 gosub moved origin dest 76 if equal moved k 77 set k dest 78 endif 79 elseif match moved q b n 80 set legal fn toupper moved origin dest 81 endif 82 if not var legal 83 die You may not move a moved from origin to dest 84 endif 85 if islower old 86 die You may not capture your own pieces. 87 endif 88 if fn ATTACKEDBYW #k 89 die You may not move into check. 90 endif 91 endsub 92 set checks sub checks #K 93 if var checks 94 if sub checkmated #K #checks 95 say Checkmate! Black has won! 96 won 97 else 98 say Check! 99 endif 100 elseif sub stalemated #K 101 say Stalemate! The game is drawn. 102 drawn 103 endif 104 end 105 106 lib chess2 107 set wpr 2 108 set bpr 7 109 set fps 2 110 set pzs 1 111 set wcastle c1 g1 112 set bcastle c8 g8 113 setsystem maxmove 2 114 ban commands allmoves 115 allow moves 1 captures 1 promotions 2 116 for x piecekeys 117 if match #x P K p k 118 continue 119 elseif isupper #x 120 push wprom #x 121 elseif islower #x 122 push bprom #x 123 endif 124 next 125 def N checkleap #0 #1 1 2 126 def B checkride #0 #1 1 1 127 def R checkride #0 #1 1 0 128 def Q fn B #0 #1 or fn R #0 #1 129 def K checkleap #0 #1 1 1 or checkleap #0 #1 1 0 130 def M fn N #0 #1 or fn R #0 #1 131 def A fn N #0 #1 or fn B #0 #1 132 def n checkleap #0 #1 1 2 133 def b checkride #0 #1 1 1 134 def r checkride #0 #1 1 0 135 def q fn B #0 #1 or fn R #0 #1 136 def k checkleap #0 #1 1 1 or checkleap #0 #1 1 0 137 def m fn N #0 #1 or fn R #0 #1 138 def a fn N #0 #1 or fn B #0 #1 139 def C cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 140 def V cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1 141 def c cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 142 def v cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1 143 def P remove var ep and checkleap #0 #1 1 1 and == var ep join filename #1 rankname #0 or and checkride #0 #1 0 1 == rankname #0 var wpr or checkleap #0 #1 0 1 and empty #1 or and islower space #1 checkleap #0 #1 1 1 and <= distance #0 #1 var fps and > rank #1 rank #0 144 def p remove var ep and checkleap #0 #1 1 1 and == var ep join filename #1 rankname #0 or and checkride #0 #1 0 1 == rankname #0 var bpr or checkleap #0 #1 0 1 and empty #1 or and isupper space #1 checkleap #0 #1 1 1 and <= distance #0 #1 var fps and < rank #1 rank #0 145 def PL filter lambda (onboard #1) mergeall where #ori -1 1 where #ori 1 1 values lambda (where #ori 0 #1) range 1 var fps =ori 146 def pL filter lambda (onboard #1) mergeall where #ori -1 -1 where #ori 1 -1 values lambda (where #ori 0 neg #1) range 1 var fps =ori 147 setflag rules 148 def NL leaps #0 1 2 149 def BL rays #0 1 1 150 def RL rays #0 1 0 151 def VL rays #0 1 1 152 def CL rays #0 1 0 153 def QL merge rays #0 1 0 rays #0 1 1 154 def KL merge leaps #0 1 0 leaps #0 1 1 155 def AL merge leaps #0 1 2 rays #0 1 1 156 def ML merge rays #0 1 0 leaps #0 1 2 157 def nL leaps #0 1 2 158 def bL rays #0 1 1 159 def rL rays #0 1 0 160 def vL rays #0 1 1 161 def cL rays #0 1 0 162 def qL merge rays #0 1 0 rays #0 1 1 163 def kL merge leaps #0 1 0 leaps #0 1 1 164 def aL merge leaps #0 1 2 rays #0 1 1 165 def mL merge rays #0 1 0 leaps #0 1 2 166 sub checked king 167 my from piece 168 if isupper cond empty #king moved space #king 169 def enemies onlylower 170 else 171 def enemies onlyupper 172 endif 173 for (from piece) fn enemies 174 if fn #piece #from #king 175 return #from 176 endif 177 next 178 return false 179 endsub 180 sub P from to 181 local ydir 182 if == file #from file #to and not capture 183 set legal checkaleap #from #to 0 1 184 if var legal 185 set ep false 186 else 187 set legal checkaride #from #to 0 1 and <= distance #from #to #fps and == rankname #from #wpr 188 set ep #to 189 endif 190 set epc false 191 elseif capture or #ep 192 set legal checkaleap #from #to -1 1 or checkaleap #from #to 1 1 193 set epc false 194 if not capture and var legal 195 set legal > rank #to rank #ep and < rankname #to #bpr and == file #to file #ep 196 if var legal 197 capture #ep 198 set epc #ep 199 endif 200 endif 201 set ep false 202 endif 203 if != space #to moved and onboard where #to 0 #pzs 204 die "You may not promote a Pawn until it reaches the promotion zone." 205 endif 206 if not onboard where #to 0 #pzs 207 if == P space #to 208 askpromote #wprom 209 elseif not match space #to var wprom 210 set np space #to 211 die "You may not promote your Pawn to a" #np 212 endif 213 endif 214 return true 215 endsub 216 sub p from to 217 if == file #from file #to and not capture 218 set legal checkaleap #from #to 0 -1 219 if var legal 220 set ep false 221 else 222 set legal checkaride #from #to 0 -1 and <= distance #from #to #fps and == rankname #from #bpr 223 set ep #to 224 endif 225 set epc false 226 elseif capture or #ep 227 set legal checkaleap #from #to -1 -1 or checkaleap #from #to 1 -1 228 set epc false 229 if not capture and var legal 230 set legal < rank #to rank #ep and > rankname #to #wpr and == file #to file #ep 231 if var legal 232 capture #ep 233 set epc #ep 234 endif 235 endif 236 set ep false 237 endif 238 if != space #to moved and onboard where #to 0 neg #pzs 239 die You may not promote a Pawn until it reaches the promotion zone. 240 endif 241 if not onboard where #to 0 neg #pzs 242 if == p space #to 243 askpromote #bprom 244 elseif not match space #to var bprom 245 set np space #to 246 die You may not promote your Pawn to a #np 247 endif 248 endif 249 return true 250 endsub 251 sub K from to 252 set legal fn K #from #to 253 if match #to where #from 2 0 where #from -2 0 254 set legal sub castle 255 endif 256 set K #to 257 unsetflag #from 258 endsub 259 sub k from to 260 set legal fn K #from #to 261 if match #to where #from 2 0 where #from -2 0 262 set legal sub castle 263 endif 264 set k #to 265 unsetflag #from 266 endsub 267 sub castle 268 local c RPOS RDEST xdir 269 if not flag #from 270 die A King may not castle after it moves. 271 endif 272 if capture 273 die A King may not castle to an occupied space. 274 endif 275 set xdir sign minus file #to file #from 276 if not checkaride #from #to #xdir 0 277 die A King may not castle across any occupied space. 278 endif 279 set c #to 280 do 281 set c where #c #xdir 0 282 if flag #c 283 break 284 elseif not onboard #c 285 die No piece was found to castle with. 286 elseif not empty #c 287 die The King cannot castle with the piece at #c 288 endif 289 loop 290 set RPOS #c 291 move #to #from 292 if sub checked #from 293 die A King may not castle out of check. 294 endif 295 store 296 for c path #from #to 297 move #from #c 298 if sub checked #c 299 die A King may not castle through check. 300 endif 301 restore 302 next 303 move #from #to 304 if == count var subargs 0 305 set RDEST where #to neg #xdir 0 306 else 307 set RDEST elem 0 subargs 308 endif 309 unsetflag #RPOS 310 move #RPOS #RDEST 311 return true 312 endsub 313 sub castlepos from to 314 local c RPOS RDEST xdir safe 315 verify flag #from 316 verify empty #to 317 set xdir sign minus file #to file #from 318 verify checkaride #from #to #xdir 0 319 verify not sub checked #from 320 set c #to 321 do 322 set c where #c #xdir 0 323 if flag #c 324 break 325 endif 326 verify onboard #c 327 verify empty #c 328 loop 329 verify flag #c 330 set RPOS #c 331 store 332 for c path #from #to 333 move #from #c 334 set safe not sub checked #c 335 restore 336 verify #safe 337 next 338 move #from #to 339 set RDEST where #to neg #xdir 0 340 move #RPOS #RDEST 341 return true 342 endsub 343 sub stalemated kingpos 344 store 345 local from piece to 346 if isupper space #kingpos 347 def friends onlyupper 348 def nofriends noupper 349 def friend isupper #0 350 set cspaces var wcastle 351 else 352 def friends onlylower 353 def nofriends nolower 354 def friend islower #0 355 set cspaces var bcastle 356 endif 357 set royal space var kingpos 358 store 359 for (from piece) fn friends 360 for to fn join #piece L #from 361 if fn #piece #from #to and not fn friend space #to and onboard #to 362 move #from #to 363 if not sub checked cond == #from #kingpos #to #kingpos 364 setlegal #from #to 365 endif 366 endif 367 restore 368 next 369 next 370 for to var cspaces 371 if sub castlepos #kingpos #to 372 if not sub checked #to 373 setlegal #kingpos #to 374 endif 375 endif 376 restore 377 next 378 return cond count system legalmoves false true 379 endsub 380 sub enpassant piece from to 381 local pe 382 verify not capture and #ep 383 verify == P toupper #piece 384 set pe join filename #to rankname #from 385 verify == #ep #pe 386 capture #ep 387 endsub 388 endlibfunctions
Array ( [.BW] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [.bw] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [_MLV_SI] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => and [6] => checkride [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [_mlv_si] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => and [6] => checkride [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [M] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => R [7] => #0 [8] => #1 ) [m] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => R [7] => #0 [8] => #1 ) [A] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => B [7] => #0 [8] => #1 ) [a] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => B [7] => #0 [8] => #1 ) [N] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 2 ) [B] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [R] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 0 ) [Q] => Array ( [0] => fn [1] => B [2] => #0 [3] => #1 [4] => or [5] => fn [6] => R [7] => #0 [8] => #1 ) [K] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [n] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 2 ) [b] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [r] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 0 ) [q] => Array ( [0] => fn [1] => B [2] => #0 [3] => #1 [4] => or [5] => fn [6] => R [7] => #0 [8] => #1 ) [k] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [C] => Array ( [0] => cond [1] => cond [2] => empty [3] => #0 [4] => capture [5] => Array ( [0] => not [1] => empty [2] => #1 ) [6] => Array ( [0] => checkhop [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [7] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [8] => and [9] => #1 ) [V] => Array ( [0] => cond [1] => cond [2] => empty [3] => #0 [4] => capture [5] => Array ( [0] => not [1] => empty [2] => #1 ) [6] => Array ( [0] => checkhop [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [7] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [8] => and [9] => #1 ) [c] => Array ( [0] => cond [1] => cond [2] => empty [3] => #0 [4] => capture [5] => Array ( [0] => not [1] => empty [2] => #1 ) [6] => Array ( [0] => checkhop [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [7] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [8] => and [9] => #1 ) [v] => Array ( [0] => cond [1] => cond [2] => empty [3] => #0 [4] => capture [5] => Array ( [0] => not [1] => empty [2] => #1 ) [6] => Array ( [0] => checkhop [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [7] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [8] => and [9] => #1 ) [P] => Array ( [0] => remove [1] => var [2] => ep [3] => and [4] => checkleap [5] => #0 [6] => #1 [7] => 1 [8] => 1 [9] => and [10] => == [11] => var [12] => ep [13] => join [14] => filename [15] => #1 [16] => rankname [17] => #0 [18] => or [19] => and [20] => checkride [21] => #0 [22] => #1 [23] => 0 [24] => 1 [25] => == [26] => rankname [27] => #0 [28] => var [29] => wpr [30] => or [31] => checkleap [32] => #0 [33] => #1 [34] => 0 [35] => 1 [36] => and [37] => empty [38] => #1 [39] => or [40] => and [41] => islower [42] => space [43] => #1 [44] => checkleap [45] => #0 [46] => #1 [47] => 1 [48] => 1 [49] => and [50] => <= [51] => distance [52] => #0 [53] => #1 [54] => var [55] => fps [56] => and [57] => > [58] => rank [59] => #1 [60] => rank [61] => #0 ) [p] => Array ( [0] => remove [1] => var [2] => ep [3] => and [4] => checkleap [5] => #0 [6] => #1 [7] => 1 [8] => 1 [9] => and [10] => == [11] => var [12] => ep [13] => join [14] => filename [15] => #1 [16] => rankname [17] => #0 [18] => or [19] => and [20] => checkride [21] => #0 [22] => #1 [23] => 0 [24] => 1 [25] => == [26] => rankname [27] => #0 [28] => var [29] => bpr [30] => or [31] => checkleap [32] => #0 [33] => #1 [34] => 0 [35] => 1 [36] => and [37] => empty [38] => #1 [39] => or [40] => and [41] => isupper [42] => space [43] => #1 [44] => checkleap [45] => #0 [46] => #1 [47] => 1 [48] => 1 [49] => and [50] => <= [51] => distance [52] => #0 [53] => #1 [54] => var [55] => fps [56] => and [57] => < [58] => rank [59] => #1 [60] => rank [61] => #0 ) [PL] => Array ( [0] => filter [1] => lambda [2] => Array ( [0] => onboard [1] => #1 ) [3] => mergeall [4] => where [5] => #ori [6] => -1 [7] => 1 [8] => where [9] => #ori [10] => 1 [11] => 1 [12] => values [13] => lambda [14] => Array ( [0] => where [1] => #ori [2] => 0 [3] => #1 ) [15] => range [16] => 1 [17] => var [18] => fps [19] => =ori ) [pL] => Array ( [0] => filter [1] => lambda [2] => Array ( [0] => onboard [1] => #1 ) [3] => mergeall [4] => where [5] => #ori [6] => -1 [7] => -1 [8] => where [9] => #ori [10] => 1 [11] => -1 [12] => values [13] => lambda [14] => Array ( [0] => where [1] => #ori [2] => 0 [3] => neg [4] => #1 ) [15] => range [16] => 1 [17] => var [18] => fps [19] => =ori ) [NL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 2 ) [BL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [RL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [VL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [CL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [QL] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [KL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 0 [5] => leaps [6] => #0 [7] => 1 [8] => 1 ) [AL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 2 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [ML] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => leaps [6] => #0 [7] => 1 [8] => 2 ) [nL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 2 ) [bL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [rL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [vL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [cL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [qL] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [kL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 0 [5] => leaps [6] => #0 [7] => 1 [8] => 1 ) [aL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 2 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [mL] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => leaps [6] => #0 [7] => 1 [8] => 2 ) )uservar
Array ( [0] => Array ( [main] => Array ( [fr] => M.BWAKR_MLV_SIQN [i] => h [wpr] => 2 [bpr] => 7 [fps] => 2 [pzs] => 1 [wcastle] => Array ( [0] => g1 [1] => c1 ) [bcastle] => Array ( [0] => g8 [1] => c8 ) [x] => P [bprom] => Array ( [0] => q [1] => m [2] => a [3] => r [4] => n ) [wprom] => Array ( [0] => Q [1] => M [2] => A [3] => R [4] => N ) ) ) )mline
Array ( [0] => MoveLine Object ( [movenum] => 0 [move] => [level] => 0 [comment] => [length] => 0 [newturn] => [turn] => 0 ) )allmoves
Array ( )movelist
constants
Array ( [firstrank] => M.BWAKR_MLV_SIQN )