Please report any bugs or errors to J Paleja

Syntax Error on line 442

The function 'dL' has not been defined. Its arguments are a8

Edit the Settings File for Chess with Pawns

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 == thismove null
   1   say This preset enforces the rules and displays legal moves.
   2 endif
   3 echo Please report any bugs or errors to J Paleja
   4 setflag a1 a8 h1 h8 e1 e8
   5 set k findpiece k spaces
   6 set K findpiece K spaces
   7 set ep false
   8 include chess3
   9 set wpr 2
  10 set bpr 7
  11 set fps 2
  12 set pzs 1
  13 set wcastle c1 g1
  14 set bcastle c8 g8
  15 set wprom M CB J D
  16 set bprom m cb j d
  17 setsystem maxmove 1
  18 ban commands allmoves
  19 allow moves 1 captures 1 promotions 2
  20 sub postauto1
  21   if not isconst alias $moved
  22     die The piece moved is undefined.
  23   elseif isupper $old
  24     die You may not capture your own pieces.
  25   elseif islower $moved
  26     die You may not move one of your opponent's pieces.
  27   endif
  28   if != const alias $moved White_Pawn
  29     set ep false
  30     if != space $dest $moved
  31       die You may not change the type of this piece.
  32     elseif capture
  33       set nopvc 0
  34     else
  35       inc nopvc
  36     endif
  37   endif
  38   set codename const alias $moved
  39   if sub #codename $origin $dest and issub #codename
  40   elseif fn #codename $origin $dest and isfunc #codename and not issub #codename
  41   else
  42     set name alias #codename
  43     set errmsg list "You may not move your" #name "from" $origin "to" join $dest ".
" 44 def KNIGHT checkleap #0 #1 1 2 45 def ROOK checkride #0 #1 1 0 46 map cb1 1 1 47 map cb2 -1 1 48 map cb3 1 -1 49 map cb4 -1 -1 50 def CBN1 logride #0 #1 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2) 51 def CBN2 logride #0 #1 (cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1) 52 def CBE1 logride #0 #1 (cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb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 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 60 def cb fn CB #0 #1 61 def cbL lograys #0 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2)(cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1)(cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3)(cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1)(cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3)(cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4)(cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2)(cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 62 def j checkleap #0 #1 1 3 63 def d checkleap #0 #1 0 2 64 def m fn KNIGHT #0 #1 or fn ROOK #0 #1 65 def J checkleap #0 #1 1 3 66 def D checkleap #0 #1 0 2 67 def M fn KNIGHT #0 #1 or fn ROOK #0 #1 68 def DL leaps #0 0 2 69 def JL leaps #0 1 3 70 def dL leaps #0 0 2 71 def jL leaps #0 1 3 72 set desc join #codename "-Desc" 73 set errmsg str_replace "_" " " join #errmsg str_replace "%s" #name var #desc 74 die #errmsg 75 endif 76 if sub checked var Kpos 77 die You may not move into check. 78 endif 79 unsetflag $origin $dest 80 set posvar join "w" join fencode boardflags 81 inc #posvar 82 endsub 83 sub postauto2 84 if not isconst alias $moved 85 die The piece $moved is undefined. 86 elseif islower $old 87 die You may not capture your own pieces. 88 elseif isupper $moved 89 die You may not move one of your opponent's pieces. 90 endif 91 if != const alias $moved Black_Pawn 92 set ep false 93 if != space $dest $moved 94 die You may not change the type of this piece. 95 elseif capture 96 set nopvc 0 97 else 98 inc nopvc 99 endif 100 endif 101 set codename const alias $moved 102 if sub #codename $origin $dest and issub #codename 103 elseif fn #codename $origin $dest and isfunc #codename and not issub #codename 104 else 105 set name alias #codename 106 set errmsg list "You may not move your" #name "from" $origin "to" join $dest ".
" 107 def KNIGHT checkleap #0 #1 1 2 108 def ROOK checkride #0 #1 1 0 109 map cb1 1 1 110 map cb2 -1 1 111 map cb3 1 -1 112 map cb4 -1 -1 113 def CBN1 logride #0 #1 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2) 114 def CBN2 logride #0 #1 (cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1) 115 def CBE1 logride #0 #1 (cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3) 116 def CBE2 logride #0 #1 (cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1) 117 def CBS1 logride #0 #1 (cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3) 118 def CBS2 logride #0 #1 (cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4) 119 def CBW1 logride #0 #1 (cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2) 120 def CBW2 logride #0 #1 (cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 121 def CB fn CBN1 #0 #1 or fn CBN2 #0 #1 or fn CBE1 #0 #1 or fn CBE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b4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2)(cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 125 def j checkleap #0 #1 1 3 126 def d checkleap #0 #1 0 2 127 def m fn KNIGHT #0 #1 or fn ROOK #0 #1 128 def J checkleap #0 #1 1 3 129 def D checkleap #0 #1 0 2 130 def M fn KNIGHT #0 #1 or fn ROOK #0 #1 131 def DL leaps #0 0 2 132 def JL leaps #0 1 3 133 def dL leaps #0 0 2 134 def jL leaps #0 1 3 135 set desc join #codename "-Desc" 136 set errmsg str_replace "_" " " join #errmsg str_replace "%s" #name var #desc 137 die #errmsg 138 endif 139 if sub checked var kpos 140 die You may not move into check. 141 endif 142 unsetflag $origin $dest 143 set posvar join "b" join fencode boardflags 144 inc #posvar 145 endsub 146 set posvar join "w" join fencode boardflags 147 if >= var #posvar 3 148 say Three Times Repetition! Drawn Game! 149 drawn 150 elseif sub stalemated var kpos 151 if sub checked var kpos 152 say Checkmate! White has won! 153 won 154 else 155 say Stalemate! The game is drawn. 156 drawn 157 endif 158 elseif >= #nopvc 100 159 say Fifty Moves Without Moving a Pawn or Capturing! Game Drawn! 160 drawn 161 elseif sub checked var kpos 162 say Check! 163 endif 164 store 165 for (from piece) fn friends 166 for to fn join #piece L #from 167 if fn #piece #from #to and not fn friend space #to and onboard #to 168 move #from #to 169 if not sub checked cond == #from #kingpos #to #kingpos 170 setlegal #from #to 171 endif 172 endif 173 restore 174 next 175 next 176 def KNIGHT checkleap #0 #1 1 2 177 def ROOK checkride #0 #1 1 0 178 map cb1 1 1 179 map cb2 -1 1 180 map cb3 1 -1 181 map cb4 -1 -1 182 def CBN1 logride #0 #1 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2) 183 def CBN2 logride #0 #1 (cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1) 184 def CBE1 logride #0 #1 (cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3) 185 def CBE2 logride #0 #1 (cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1) 186 def CBS1 logride #0 #1 (cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3) 187 def CBS2 logride #0 #1 (cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4) 188 def CBW1 logride #0 #1 (cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2) 189 def CBW2 logride #0 #1 (cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 190 def CB fn CBN1 #0 #1 or fn CBN2 #0 #1 or fn CBE1 #0 #1 or fn CBE2 #0 #1 or fn CBS1 #0 #1 or fn CBS2 #0 #1 or fn CBW1 #0 #1 or fn CBW2 #0 #1 191 def CBL lograys #0 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2)(cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1)(cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3)(cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1)(cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3)(cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4)(cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2)(cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 192 def cb fn CB #0 #1 193 def cbL lograys #0 (cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2)(cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1 cb2 cb1)(cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3)(cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1 cb3 cb1)(cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3)(cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4 cb3 cb4)(cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2)(cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4 cb2 cb4) 194 def j checkleap #0 #1 1 3 195 def d checkleap #0 #1 0 2 196 def m fn KNIGHT #0 #1 or fn ROOK #0 #1 197 def J checkleap #0 #1 1 3 198 def D checkleap #0 #1 0 2 199 def M fn KNIGHT #0 #1 or fn ROOK #0 #1 200 def DL leaps #0 0 2 201 def JL leaps #0 1 3 202 def dL leaps #0 0 2 203 def jL leaps #0 1 3 204 end 205 206 lib chess3 207 set wpr 2 208 set bpr 7 209 set fps 2 210 set pzs 1 211 set wcastle c1 g1 212 set bcastle c8 g8 213 set wprom Q R B N 214 set bprom q r b n 215 setsystem maxmove 2 216 ban commands allmoves 217 allow moves 1 captures 1 promotions 2 218 def N checkleap #0 #1 1 2 219 def B checkride #0 #1 1 1 220 def R checkride #0 #1 1 0 221 def Q fn B #0 #1 or fn R #0 #1 222 def K checkleap #0 #1 1 1 or checkleap #0 #1 1 0 223 def M fn N #0 #1 or fn R #0 #1 224 def A fn N #0 #1 or fn B #0 #1 225 def n checkleap #0 #1 1 2 226 def b checkride #0 #1 1 1 227 def r checkride #0 #1 1 0 228 def q fn B #0 #1 or fn R #0 #1 229 def k checkleap #0 #1 1 1 or checkleap #0 #1 1 0 230 def m fn N #0 #1 or fn R #0 #1 231 def a fn N #0 #1 or fn B #0 #1 232 def C cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 233 def V cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1 234 def c cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1 235 def v cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1 236 def P remove var ep and < rankname #1 var bpr and < rankname var ep rankname #1 and == filename var ep filename #1 and checkleap #0 #1 1 1 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 237 def p remove var ep and > rankname #1 var wpr and > rankname var ep rankname #1 and == filename var ep filename #1 and checkleap #0 #1 1 1 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 238 def PL array where #0 0 2 where #0 0 1 where #0 -1 1 where #0 1 1 239 def pL array where #0 0 -2 where #0 0 -1 where #0 -1 -1 where #0 1 -1 240 def NL leaps #0 1 2 241 def BL rays #0 1 1 242 def RL rays #0 1 0 243 def VL rays #0 1 1 244 def CL rays #0 1 0 245 def QL merge rays #0 1 0 rays #0 1 1 246 def KL merge leaps #0 1 0 leaps #0 1 1 247 def AL merge leaps #0 1 2 rays #0 1 1 248 def ML merge rays #0 1 0 leaps #0 1 2 249 def nL leaps #0 1 2 250 def bL rays #0 1 1 251 def rL rays #0 1 0 252 def vL rays #0 1 1 253 def cL rays #0 1 0 254 def qL merge rays #0 1 0 rays #0 1 1 255 def kL merge leaps #0 1 0 leaps #0 1 1 256 def aL merge leaps #0 1 2 rays #0 1 1 257 def mL merge rays #0 1 0 leaps #0 1 2 258 def @ false 259 sub checked king 260 my from piece 261 if isupper cond empty #king moved space #king 262 def enemies onlylower 263 else 264 def enemies onlyupper 265 endif 266 for (from piece) fn enemies 267 if fn #piece #from #king 268 return #from 269 endif 270 next 271 return false 272 endsub 273 sub P from to 274 verify > rank #to rank #from 275 verify <= distance #to #from #fps 276 if capture 277 verify checkleap #from #to 1 1 278 set ep false 279 elseif checkleap #from #to 1 1 and #ep 280 verify == filename var ep filename #to 281 verify < rankname var ep rankname #to 282 verify < rankname #to var bpr 283 capture #ep 284 set ep false 285 elseif > distance #to #from 1 286 verify == rankname #from #wpr 287 verify checkride #from #to 0 1 288 set ep #to 289 else 290 verify checkleap #from #to 0 1 291 set ep false 292 endif 293 if onboard where #to 0 #pzs 294 if != space #to moved 295 die "You may not promote a Pawn until it reaches the promotion zone." 296 endif 297 elseif == P space #to 298 askpromote #wprom 299 elseif not match space #to var wprom 300 set np space #to 301 die "You may not promote your Pawn to a" #np 302 endif 303 set nopvc 0 304 return true 305 endsub 306 sub p from to 307 verify < rank #to rank #from 308 verify <= distance #to #from #fps 309 if capture 310 verify checkleap #from #to 1 1 311 set ep false 312 elseif checkleap #from #to 1 1 and #ep 313 verify == filename var ep filename #to 314 verify > rankname var ep rankname #to 315 verify > rankname #to var wpr 316 capture #ep 317 set ep false 318 elseif > distance #to #from 1 319 verify == rankname #from #bpr 320 verify checkride #from #to 0 1 321 set ep #to 322 else 323 verify checkleap #from #to 0 1 324 set ep false 325 endif 326 if != space #to moved and onboard where #to 0 neg #pzs 327 die You may not promote a Pawn until it reaches the promotion zone. 328 endif 329 if not onboard where #to 0 neg #pzs 330 if == p space #to 331 askpromote #bprom 332 elseif not match space #to var bprom 333 set np space #to 334 die You may not promote your Pawn to a #np 335 endif 336 endif 337 set nopvc 0 338 return true 339 endsub 340 sub K from to 341 if not fn K #from #to 342 verify sub castle #from #to and match #to var wcastle 343 endif 344 set K #to 345 return true 346 endsub 347 sub k from to 348 if not fn k #from #to 349 verify sub castle #from #to and match #to var bcastle 350 endif 351 set k #to 352 return true 353 endsub 354 sub castle from to 355 local c RPOS RDEST xdir 356 if not flag #from 357 die A King may not castle after it moves. 358 endif 359 if capture 360 die A King may not castle to an occupied space. 361 endif 362 set xdir sign minus file #to file #from 363 if not checkaride #from #to #xdir 0 364 die A King may not castle across any occupied space. 365 endif 366 set c #to 367 do 368 set c where #c #xdir 0 369 if flag #c 370 break 371 elseif not onboard #c 372 die No piece was found to castle with. 373 elseif not empty #c 374 die The King cannot castle with the piece at #c 375 endif 376 loop 377 set RPOS #c 378 move #to #from 379 if sub checked #from 380 die A King may not castle out of check. 381 endif 382 store 383 for c path #from #to 384 move #from #c 385 if sub checked #c 386 die A King may not castle through check. 387 endif 388 restore 389 next 390 move #from #to 391 set RDEST where #to neg #xdir 0 392 move #RPOS #RDEST 393 return true 394 endsub 395 sub castlepos from to 396 local c RPOS RDEST xdir safe 397 verify flag #from 398 verify empty #to 399 set xdir sign minus file #to file #from 400 verify checkaride #from #to #xdir 0 401 verify not sub checked #from 402 set c #to 403 do 404 set c where #c #xdir 0 405 if flag #c 406 break 407 endif 408 verify onboard #c 409 verify empty #c 410 loop 411 verify flag #c 412 set RPOS #c 413 store 414 for c path #from #to 415 move #from #c 416 set safe not sub checked #c 417 restore 418 verify #safe 419 next 420 move #from #to 421 set RDEST where #to neg #xdir 0 422 move #RPOS #RDEST 423 set safe not sub checked #to 424 restore 425 return #safe 426 endsub 427 sub stalemated kingpos 428 store 429 local from piece to 430 if isupper space #kingpos 431 def friends onlyupper 432 def friend isupper #0 433 set cspaces var wcastle 434 else 435 def friends onlylower 436 def friend islower #0 437 set cspaces var bcastle 438 endif 439 set royal space var kingpos 440 store 441 for (from piece) fn friends 442 for to fn join #piece L #from 443 if fn #piece #from #to and not fn friend space #to and onboard #to 444 move #from #to 445 if not sub checked cond == #from #kingpos #to #kingpos 446 setlegal #from #to 447 endif 448 endif 449 restore 450 next 451 next 452 for to var cspaces 453 if sub castlepos #kingpos #to 454 setlegal #kingpos #to 455 endif 456 next 457 return cond count system legalmoves false true 458 endsub 459 sub enpassant piece from to 460 local pe 461 verify not capture and #ep 462 verify == P toupper #piece 463 set pe join filename #to rankname #from 464 verify == #ep #pe 465 capture #ep 466 endsub 467 endlib

functions

Array ( [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 ) [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 ) [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 ) [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 ) [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] => < [5] => rankname [6] => #1 [7] => var [8] => bpr [9] => and [10] => < [11] => rankname [12] => var [13] => ep [14] => rankname [15] => #1 [16] => and [17] => == [18] => filename [19] => var [20] => ep [21] => filename [22] => #1 [23] => and [24] => checkleap [25] => #0 [26] => #1 [27] => 1 [28] => 1 [29] => or [30] => and [31] => checkride [32] => #0 [33] => #1 [34] => 0 [35] => 1 [36] => == [37] => rankname [38] => #0 [39] => var [40] => wpr [41] => or [42] => checkleap [43] => #0 [44] => #1 [45] => 0 [46] => 1 [47] => and [48] => empty [49] => #1 [50] => or [51] => and [52] => islower [53] => space [54] => #1 [55] => checkleap [56] => #0 [57] => #1 [58] => 1 [59] => 1 [60] => and [61] => <= [62] => distance [63] => #0 [64] => #1 [65] => var [66] => fps [67] => and [68] => > [69] => rank [70] => #1 [71] => rank [72] => #0 ) [p] => Array ( [0] => remove [1] => var [2] => ep [3] => and [4] => > [5] => rankname [6] => #1 [7] => var [8] => wpr [9] => and [10] => > [11] => rankname [12] => var [13] => ep [14] => rankname [15] => #1 [16] => and [17] => == [18] => filename [19] => var [20] => ep [21] => filename [22] => #1 [23] => and [24] => checkleap [25] => #0 [26] => #1 [27] => 1 [28] => 1 [29] => or [30] => and [31] => checkride [32] => #0 [33] => #1 [34] => 0 [35] => 1 [36] => == [37] => rankname [38] => #0 [39] => var [40] => bpr [41] => or [42] => checkleap [43] => #0 [44] => #1 [45] => 0 [46] => 1 [47] => and [48] => empty [49] => #1 [50] => or [51] => and [52] => isupper [53] => space [54] => #1 [55] => checkleap [56] => #0 [57] => #1 [58] => 1 [59] => 1 [60] => and [61] => <= [62] => distance [63] => #0 [64] => #1 [65] => var [66] => fps [67] => and [68] => < [69] => rank [70] => #1 [71] => rank [72] => #0 ) [PL] => Array ( [0] => array [1] => where [2] => #0 [3] => 0 [4] => 2 [5] => where [6] => #0 [7] => 0 [8] => 1 [9] => where [10] => #0 [11] => -1 [12] => 1 [13] => where [14] => #0 [15] => 1 [16] => 1 ) [pL] => Array ( [0] => array [1] => where [2] => #0 [3] => 0 [4] => -2 [5] => where [6] => #0 [7] => 0 [8] => -1 [9] => where [10] => #0 [11] => -1 [12] => -1 [13] => where [14] => #0 [15] => 1 [16] => -1 ) [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 ) [@] => Array ( [0] => false ) [friends] => Array ( [0] => onlylower ) [friend] => Array ( [0] => islower [1] => #0 ) )

uservar

Array ( [0] => Array ( [main] => Array ( [k] => e8 [K] => e1 [ep] => [wpr] => 2 [bpr] => 7 [fps] => 2 [pzs] => 1 [wcastle] => Array ( [0] => g1 [1] => c1 ) [bcastle] => Array ( [0] => g8 [1] => c8 ) [wprom] => Array ( [0] => D [1] => J [2] => CB [3] => M ) [bprom] => Array ( [0] => d [1] => j [2] => cb [3] => m ) [posvar] => wdj{cb}mk{cb}jdpppppppp32PPPPPPPPDJ{CB}MK{CB}JD,a1,a8,e1,e8,h1,h8 [cspaces] => Array ( [0] => g8 [1] => c8 ) [royal] => ) ) [2] => Array ( [stalemated] => Array ( [subargs] => Array ( [0] => ) ) [main] => Array ( [kingpos] => [from] => a8 [piece] => d [to] => 0 ) ) )

mline

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

allmoves

Array ( )

movelist

constants

Array ( )