array (
  0 => 'echo',
  1 => 'This',
  2 => 'preset',
  3 => 'uses',
  4 => 'code',
  5 => 'to',
  6 => 'identify',
  7 => 'legal',
  8 => 'moves',
  9 => 'and',
  10 => 'drops,',
  11 => 'en',
  12 => 'passant,',
  13 => 'castling,',
  14 => 'check,',
  15 => 'checkmate,',
  16 => 'and',
  17 => 'stalemate.',
)1 [main 0:main]: echo This preset uses code to identify legal moves and drops, en passant,  castling, check, checkmate, and stalemate.

This preset uses code to identify legal moves and drops, en passant, castling, check, checkmate, and stalemate.

array ( 0 => 'empty', 1 => 'd4', )2 [main 0:main]: empty d4

array ( 0 => 'empty', 1 => 'd5', )3 [main 0:main]: empty d5

array ( 0 => 'empty', 1 => 'e4', )4 [main 0:main]: empty e4

array ( 0 => 'empty', 1 => 'e5', )5 [main 0:main]: empty e5

array ( 0 => 'def', 1 => 'isafreedrop', 2 => 'nor', 3 => 'origin', 4 => 'capture', )6 [main 0:main]: def isafreedrop nor origin capture

array ( 0 => 'setflag', 1 => 'a1', 2 => 'a8', 3 => 'h1', 4 => 'h8', 5 => 'e1', 6 => 'e8', )7 [main 0:main]: setflag a1 a8 h1 h8 e1 e8

array ( 0 => 'set', 1 => 'k', 2 => 'e8', )8 [main 0:main]: set k e8

array ( 0 => 'set', 1 => 'K', 2 => 'e1', )9 [main 0:main]: set K e1

array ( 0 => 'set', 1 => 'Drop1', 2 => 'false', )10 [main 0:main]: set Drop1 false

array ( 0 => 'set', 1 => 'Drop2', 2 => 'false', )11 [main 0:main]: set Drop2 false

array ( 0 => 'set', 1 => 'drop1', 2 => 'false', )12 [main 0:main]: set drop1 false

array ( 0 => 'set', 1 => 'drop2', 2 => 'false', )13 [main 0:main]: set drop2 false

array ( 0 => 'set', 1 => 'ep', 2 => 'false', )14 [main 0:main]: set ep false

array ( 0 => 'include', 1 => 'chess2', )15 [main 0:main]: include chess2

array ( 0 => 'set', 1 => 'wpr', 2 => '2', )133 [main 0:main]: set wpr 2

array ( 0 => 'set', 1 => 'bpr', 2 => '7', )134 [main 0:main]: set bpr 7

array ( 0 => 'set', 1 => 'fps', 2 => '2', )135 [main 0:main]: set fps 2

array ( 0 => 'set', 1 => 'pzs', 2 => '1', )136 [main 0:main]: set pzs 1

array ( 0 => 'set', 1 => 'wcastle', 2 => 'c1', 3 => 'g1', )137 [main 0:main]: set wcastle c1 g1

array ( 0 => 'set', 1 => 'bcastle', 2 => 'c8', 3 => 'g8', )138 [main 0:main]: set bcastle c8 g8

array ( 0 => 'setsystem', 1 => 'maxmove', 2 => '2', )139 [main 0:main]: setsystem maxmove 2

array ( 0 => 'ban', 1 => 'commands', 2 => 'allmoves', )140 [main 0:main]: ban commands allmoves

array ( 0 => 'allow', 1 => 'moves', 2 => '1', 3 => 'captures', 4 => '1', 5 => 'promotions', 6 => '2', )141 [main 0:main]: allow moves 1 captures 1 promotions 2

array ( 0 => 'for', 1 => 'x', 2 => 'piecekeys', )142 [main 0:main]: for x piecekeys

array ( 0 => 'if', 1 => 'match', 2 => 'r', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'r', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'r', )147 [main 2:if]: elseif islower #x

array ( 0 => 'push', 1 => 'bprom', 2 => 'r', )148 [main 2:if]: push bprom #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'n', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'n', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'n', )147 [main 2:if]: elseif islower #x

array ( 0 => 'push', 1 => 'bprom', 2 => 'n', )148 [main 2:if]: push bprom #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'b', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'b', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'b', )147 [main 2:if]: elseif islower #x

array ( 0 => 'push', 1 => 'bprom', 2 => 'b', )148 [main 2:if]: push bprom #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'q', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'q', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'q', )147 [main 2:if]: elseif islower #x

array ( 0 => 'push', 1 => 'bprom', 2 => 'q', )148 [main 2:if]: push bprom #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'k', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'continue', )144 [main 2:if]: continue

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'p', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'continue', )144 [main 2:if]: continue

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'm', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'm', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'm', )147 [main 2:if]: elseif islower #x

array ( 0 => 'push', 1 => 'bprom', 2 => 'm', )148 [main 2:if]: push bprom #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'M', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'M', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'push', 1 => 'wprom', 2 => 'M', )146 [main 2:if]: push wprom #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'M', )147 [main 2:if]: elseif islower #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'P', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'continue', )144 [main 2:if]: continue

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'R', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'R', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'push', 1 => 'wprom', 2 => 'R', )146 [main 2:if]: push wprom #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'R', )147 [main 2:if]: elseif islower #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'N', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'N', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'push', 1 => 'wprom', 2 => 'N', )146 [main 2:if]: push wprom #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'N', )147 [main 2:if]: elseif islower #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'B', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'B', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'push', 1 => 'wprom', 2 => 'B', )146 [main 2:if]: push wprom #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'B', )147 [main 2:if]: elseif islower #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'Q', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'elseif', 1 => 'isupper', 2 => 'Q', )145 [main 2:if]: elseif isupper #x

array ( 0 => 'push', 1 => 'wprom', 2 => 'Q', )146 [main 2:if]: push wprom #x

array ( 0 => 'elseif', 1 => 'islower', 2 => 'Q', )147 [main 2:if]: elseif islower #x

array ( 0 => 'endif', )149 [main 2:if]: endif

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'if', 1 => 'match', 2 => 'K', 3 => 'P', 4 => 'K', 5 => 'p', 6 => 'k', )143 [main 1:for]: if match #x P K p k

array ( 0 => 'continue', )144 [main 2:if]: continue

array ( 0 => 'next', )150 [main 1:for]: next

array ( 0 => 'def', 1 => 'N', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '2', )151 [main 0:main]: def N checkleap #0 #1 1 2

array ( 0 => 'def', 1 => 'B', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', )152 [main 0:main]: def B checkride #0 #1 1 1

array ( 0 => 'def', 1 => 'R', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '0', )153 [main 0:main]: def R checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'Q', 2 => 'fn', 3 => 'B', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'R', 9 => '#0', 10 => '#1', )154 [main 0:main]: def Q fn B #0 #1 or fn R #0 #1

array ( 0 => 'def', 1 => 'K', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkleap', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', )155 [main 0:main]: def K checkleap #0 #1 1 1 or checkleap #0 #1 1 0

array ( 0 => 'def', 1 => 'M', 2 => 'fn', 3 => 'N', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'R', 9 => '#0', 10 => '#1', )156 [main 0:main]: def M fn N #0 #1 or fn R #0 #1

array ( 0 => 'def', 1 => 'A', 2 => 'fn', 3 => 'N', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'B', 9 => '#0', 10 => '#1', )157 [main 0:main]: def A fn N #0 #1 or fn B #0 #1

array ( 0 => 'def', 1 => 'n', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '2', )158 [main 0:main]: def n checkleap #0 #1 1 2

array ( 0 => 'def', 1 => 'b', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', )159 [main 0:main]: def b checkride #0 #1 1 1

array ( 0 => 'def', 1 => 'r', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '0', )160 [main 0:main]: def r checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'q', 2 => 'fn', 3 => 'B', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'R', 9 => '#0', 10 => '#1', )161 [main 0:main]: def q fn B #0 #1 or fn R #0 #1

array ( 0 => 'def', 1 => 'k', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkleap', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', )162 [main 0:main]: def k checkleap #0 #1 1 1 or checkleap #0 #1 1 0

array ( 0 => 'def', 1 => 'm', 2 => 'fn', 3 => 'N', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'R', 9 => '#0', 10 => '#1', )163 [main 0:main]: def m fn N #0 #1 or fn R #0 #1

array ( 0 => 'def', 1 => 'a', 2 => 'fn', 3 => 'N', 4 => '#0', 5 => '#1', 6 => 'or', 7 => 'fn', 8 => 'B', 9 => '#0', 10 => '#1', )164 [main 0:main]: def a fn N #0 #1 or fn B #0 #1

array ( 0 => 'def', 1 => 'C', 2 => 'cond', 3 => 'cond', 4 => 'empty', 5 => '#0', 6 => 'capture', 7 => array ( 0 => 'not', 1 => 'empty', 2 => '#1', ), 8 => array ( 0 => 'checkhop', 1 => '#0', 2 => '#1', 3 => '0', 4 => '1', ), 9 => array ( 0 => 'checkride', 1 => '#0', 2 => '#1', 3 => '0', 4 => '1', ), 10 => 'and', 11 => '#1', )165 [main 0:main]: def C cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1

array ( 0 => 'def', 1 => 'V', 2 => 'cond', 3 => 'cond', 4 => 'empty', 5 => '#0', 6 => 'capture', 7 => array ( 0 => 'not', 1 => 'empty', 2 => '#1', ), 8 => array ( 0 => 'checkhop', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', ), 9 => array ( 0 => 'checkride', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', ), 10 => 'and', 11 => '#1', )166 [main 0:main]: def V cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1

array ( 0 => 'def', 1 => 'c', 2 => 'cond', 3 => 'cond', 4 => 'empty', 5 => '#0', 6 => 'capture', 7 => array ( 0 => 'not', 1 => 'empty', 2 => '#1', ), 8 => array ( 0 => 'checkhop', 1 => '#0', 2 => '#1', 3 => '0', 4 => '1', ), 9 => array ( 0 => 'checkride', 1 => '#0', 2 => '#1', 3 => '0', 4 => '1', ), 10 => 'and', 11 => '#1', )167 [main 0:main]: def c cond cond empty #0 capture (not empty #1) (checkhop #0 #1 0 1) (checkride #0 #1 0 1) and #1

array ( 0 => 'def', 1 => 'v', 2 => 'cond', 3 => 'cond', 4 => 'empty', 5 => '#0', 6 => 'capture', 7 => array ( 0 => 'not', 1 => 'empty', 2 => '#1', ), 8 => array ( 0 => 'checkhop', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', ), 9 => array ( 0 => 'checkride', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', ), 10 => 'and', 11 => '#1', )168 [main 0:main]: def v cond cond empty #0 capture (not empty #1) (checkhop #0 #1 1 1) (checkride #0 #1 1 1) and #1

array ( 0 => 'def', 1 => 'P', 2 => 'remove', 3 => 'var', 4 => 'ep', 5 => 'and', 6 => 'checkleap', 7 => '#0', 8 => '#1', 9 => '1', 10 => '1', 11 => 'and', 12 => '==', 13 => 'var', 14 => 'ep', 15 => 'join', 16 => 'filename', 17 => '#1', 18 => 'rankname', 19 => '#0', 20 => 'or', 21 => 'and', 22 => 'checkride', 23 => '#0', 24 => '#1', 25 => '0', 26 => '1', 27 => '==', 28 => 'rankname', 29 => '#0', 30 => 'var', 31 => 'wpr', 32 => 'or', 33 => 'checkleap', 34 => '#0', 35 => '#1', 36 => '0', 37 => '1', 38 => 'and', 39 => 'empty', 40 => '#1', 41 => 'or', 42 => 'and', 43 => 'islower', 44 => 'space', 45 => '#1', 46 => 'checkleap', 47 => '#0', 48 => '#1', 49 => '1', 50 => '1', 51 => 'and', 52 => '<=', 53 => 'distance', 54 => '#0', 55 => '#1', 56 => 'var', 57 => 'fps', 58 => 'and', 59 => '>', 60 => 'rank', 61 => '#1', 62 => 'rank', 63 => '#0', )169 [main 0:main]: 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

array ( 0 => 'def', 1 => 'p', 2 => 'remove', 3 => 'var', 4 => 'ep', 5 => 'and', 6 => 'checkleap', 7 => '#0', 8 => '#1', 9 => '1', 10 => '1', 11 => 'and', 12 => '==', 13 => 'var', 14 => 'ep', 15 => 'join', 16 => 'filename', 17 => '#1', 18 => 'rankname', 19 => '#0', 20 => 'or', 21 => 'and', 22 => 'checkride', 23 => '#0', 24 => '#1', 25 => '0', 26 => '1', 27 => '==', 28 => 'rankname', 29 => '#0', 30 => 'var', 31 => 'bpr', 32 => 'or', 33 => 'checkleap', 34 => '#0', 35 => '#1', 36 => '0', 37 => '1', 38 => 'and', 39 => 'empty', 40 => '#1', 41 => 'or', 42 => 'and', 43 => 'isupper', 44 => 'space', 45 => '#1', 46 => 'checkleap', 47 => '#0', 48 => '#1', 49 => '1', 50 => '1', 51 => 'and', 52 => '<=', 53 => 'distance', 54 => '#0', 55 => '#1', 56 => 'var', 57 => 'fps', 58 => 'and', 59 => '<', 60 => 'rank', 61 => '#1', 62 => 'rank', 63 => '#0', )170 [main 0:main]: 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

array ( 0 => 'def', 1 => 'PL', 2 => 'filter', 3 => 'lambda', 4 => array ( 0 => 'onboard', 1 => '#1', ), 5 => 'mergeall', 6 => 'where', 7 => '#ori', 8 => '-1', 9 => '1', 10 => 'where', 11 => '#ori', 12 => '1', 13 => '1', 14 => 'values', 15 => 'lambda', 16 => array ( 0 => 'where', 1 => '#ori', 2 => '0', 3 => '#1', ), 17 => 'range', 18 => '1', 19 => 'var', 20 => 'fps', 21 => '=ori', )171 [main 0:main]: 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

array ( 0 => 'def', 1 => 'pL', 2 => 'filter', 3 => 'lambda', 4 => array ( 0 => 'onboard', 1 => '#1', ), 5 => 'mergeall', 6 => 'where', 7 => '#ori', 8 => '-1', 9 => '-1', 10 => 'where', 11 => '#ori', 12 => '1', 13 => '-1', 14 => 'values', 15 => 'lambda', 16 => array ( 0 => 'where', 1 => '#ori', 2 => '0', 3 => 'neg', 4 => '#1', ), 17 => 'range', 18 => '1', 19 => 'var', 20 => 'fps', 21 => '=ori', )172 [main 0:main]: 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

array ( 0 => 'setflag', 1 => 'rules', )173 [main 0:main]: setflag rules

array ( 0 => 'def', 1 => 'NL', 2 => 'leaps', 3 => '#0', 4 => '1', 5 => '2', )174 [main 0:main]: def NL leaps #0 1 2

array ( 0 => 'def', 1 => 'BL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '1', )175 [main 0:main]: def BL rays #0 1 1

array ( 0 => 'def', 1 => 'RL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '0', )176 [main 0:main]: def RL rays #0 1 0

array ( 0 => 'def', 1 => 'VL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '1', )177 [main 0:main]: def VL rays #0 1 1

array ( 0 => 'def', 1 => 'CL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '0', )178 [main 0:main]: def CL rays #0 1 0

array ( 0 => 'def', 1 => 'QL', 2 => 'merge', 3 => 'rays', 4 => '#0', 5 => '1', 6 => '0', 7 => 'rays', 8 => '#0', 9 => '1', 10 => '1', )179 [main 0:main]: def QL merge rays #0 1 0 rays #0 1 1

array ( 0 => 'def', 1 => 'KL', 2 => 'merge', 3 => 'leaps', 4 => '#0', 5 => '1', 6 => '0', 7 => 'leaps', 8 => '#0', 9 => '1', 10 => '1', )180 [main 0:main]: def KL merge leaps #0 1 0 leaps #0 1 1

array ( 0 => 'def', 1 => 'AL', 2 => 'merge', 3 => 'leaps', 4 => '#0', 5 => '1', 6 => '2', 7 => 'rays', 8 => '#0', 9 => '1', 10 => '1', )181 [main 0:main]: def AL merge leaps #0 1 2 rays #0 1 1

array ( 0 => 'def', 1 => 'ML', 2 => 'merge', 3 => 'rays', 4 => '#0', 5 => '1', 6 => '0', 7 => 'leaps', 8 => '#0', 9 => '1', 10 => '2', )182 [main 0:main]: def ML merge rays #0 1 0 leaps #0 1 2

array ( 0 => 'def', 1 => 'nL', 2 => 'leaps', 3 => '#0', 4 => '1', 5 => '2', )183 [main 0:main]: def nL leaps #0 1 2

array ( 0 => 'def', 1 => 'bL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '1', )184 [main 0:main]: def bL rays #0 1 1

array ( 0 => 'def', 1 => 'rL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '0', )185 [main 0:main]: def rL rays #0 1 0

array ( 0 => 'def', 1 => 'vL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '1', )186 [main 0:main]: def vL rays #0 1 1

array ( 0 => 'def', 1 => 'cL', 2 => 'rays', 3 => '#0', 4 => '1', 5 => '0', )187 [main 0:main]: def cL rays #0 1 0

array ( 0 => 'def', 1 => 'qL', 2 => 'merge', 3 => 'rays', 4 => '#0', 5 => '1', 6 => '0', 7 => 'rays', 8 => '#0', 9 => '1', 10 => '1', )188 [main 0:main]: def qL merge rays #0 1 0 rays #0 1 1

array ( 0 => 'def', 1 => 'kL', 2 => 'merge', 3 => 'leaps', 4 => '#0', 5 => '1', 6 => '0', 7 => 'leaps', 8 => '#0', 9 => '1', 10 => '1', )189 [main 0:main]: def kL merge leaps #0 1 0 leaps #0 1 1

array ( 0 => 'def', 1 => 'aL', 2 => 'merge', 3 => 'leaps', 4 => '#0', 5 => '1', 6 => '2', 7 => 'rays', 8 => '#0', 9 => '1', 10 => '1', )190 [main 0:main]: def aL merge leaps #0 1 2 rays #0 1 1

array ( 0 => 'def', 1 => 'mL', 2 => 'merge', 3 => 'rays', 4 => '#0', 5 => '1', 6 => '0', 7 => 'leaps', 8 => '#0', 9 => '1', 10 => '2', )191 [main 0:main]: def mL merge rays #0 1 0 leaps #0 1 2

array ( 0 => 'sub', 1 => 'checked', 2 => 'king', )192 [main 0:main]: sub checked king

array ( 0 => 'sub', 1 => 'P', 2 => 'from', 3 => 'to', )206 [main 0:main]: sub P from to

array ( 0 => 'sub', 1 => 'p', 2 => 'from', 3 => 'to', )242 [main 0:main]: sub p from to

array ( 0 => 'sub', 1 => 'K', 2 => 'from', 3 => 'to', )277 [main 0:main]: sub K from to

array ( 0 => 'sub', 1 => 'k', 2 => 'from', 3 => 'to', )285 [main 0:main]: sub k from to

array ( 0 => 'sub', 1 => 'castle', )293 [main 0:main]: sub castle

array ( 0 => 'sub', 1 => 'castlepos', 2 => 'from', 3 => 'to', )339 [main 0:main]: sub castlepos from to

array ( 0 => 'sub', 1 => 'stalemated', 2 => 'kingpos', )369 [main 0:main]: sub stalemated kingpos

array ( 0 => 'sub', 1 => 'enpassant', 2 => 'piece', 3 => 'from', 4 => 'to', )406 [main 0:main]: sub enpassant piece from to

array ( 0 => 'endlib', )414 [main 0:main]: endlib

array ( 0 => 'allow', 1 => 'moves', 2 => '1', 3 => 'captures', 4 => '1', 5 => 'freedrops', 6 => '1', 7 => 'promotions', 8 => '2', )16 [main 0:main]: allow moves 1 captures 1 freedrops 1 promotions 2

array ( 0 => 'def', 1 => 'Q', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkride', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', )17 [main 0:main]: def Q checkride #0 #1 1 1 or checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'q', 2 => 'checkride', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkride', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', )18 [main 0:main]: def q checkride #0 #1 1 1 or checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'M', 2 => 'or', 3 => array ( 0 => '==', 1 => 'rankname', 2 => '#1', 3 => '1', 4 => 'and', 5 => 'fn', 6 => 'isafreedrop', ), 4 => array ( 0 => 'checkleap', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', 5 => 'or', 6 => 'checkleap', 7 => '#0', 8 => '#1', 9 => '1', 10 => '0', 11 => 'or', 12 => 'checkleap', 13 => '#0', 14 => '#1', 15 => '2', 16 => '2', 17 => 'or', 18 => 'checkleap', 19 => '#0', 20 => '#1', 21 => '2', 22 => '0', ), )19 [main 0:main]: def M or (== rankname #1 1 and fn isafreedrop) (checkleap #0 #1 1 1 or checkleap #0 #1 1 0 or checkleap #0 #1 2 2 or checkleap #0 #1 2 0)

array ( 0 => 'def', 1 => 'm', 2 => 'or', 3 => array ( 0 => '==', 1 => 'rankname', 2 => '#1', 3 => '8', 4 => 'and', 5 => 'fn', 6 => 'isafreedrop', ), 4 => array ( 0 => 'checkleap', 1 => '#0', 2 => '#1', 3 => '1', 4 => '1', 5 => 'or', 6 => 'checkleap', 7 => '#0', 8 => '#1', 9 => '1', 10 => '0', 11 => 'or', 12 => 'checkleap', 13 => '#0', 14 => '#1', 15 => '2', 16 => '2', 17 => 'or', 18 => 'checkleap', 19 => '#0', 20 => '#1', 21 => '2', 22 => '0', ), )20 [main 0:main]: def m or (== rankname #1 8 and fn isafreedrop) (checkleap #0 #1 1 1 or checkleap #0 #1 1 0 or checkleap #0 #1 2 2 or checkleap #0 #1 2 0)

array ( 0 => 'def', 1 => 'B', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '0', 7 => 'and', 8 => 'nor', 9 => 'capture', 10 => 'nor', 11 => 'empty', 12 => '#0', 13 => 'empty', 14 => '#1', 15 => 'or', 16 => 'checkride', 17 => '#0', 18 => '#1', 19 => '1', 20 => '1', )21 [main 0:main]: def B checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 1

array ( 0 => 'def', 1 => 'b', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '0', 7 => 'and', 8 => 'nor', 9 => 'capture', 10 => 'nor', 11 => 'empty', 12 => '#0', 13 => 'empty', 14 => '#1', 15 => 'or', 16 => 'checkride', 17 => '#0', 18 => '#1', 19 => '1', 20 => '1', )22 [main 0:main]: def b checkleap #0 #1 1 0 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 1

array ( 0 => 'def', 1 => 'R', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'and', 8 => 'nor', 9 => 'capture', 10 => 'nor', 11 => 'empty', 12 => '#0', 13 => 'empty', 14 => '#1', 15 => 'or', 16 => 'checkride', 17 => '#0', 18 => '#1', 19 => '1', 20 => '0', )23 [main 0:main]: def R checkleap #0 #1 1 1 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'r', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'and', 8 => 'nor', 9 => 'capture', 10 => 'nor', 11 => 'empty', 12 => '#0', 13 => 'empty', 14 => '#1', 15 => 'or', 16 => 'checkride', 17 => '#0', 18 => '#1', 19 => '1', 20 => '0', )24 [main 0:main]: def r checkleap #0 #1 1 1 and nor capture nor empty #0 empty #1 or checkride #0 #1 1 0

array ( 0 => 'def', 1 => 'N', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkleap', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', 13 => 'and', 14 => 'nor', 15 => 'capture', 16 => 'nor', 17 => 'empty', 18 => '#0', 19 => 'empty', 20 => '#1', 21 => 'or', 22 => 'checkleap', 23 => '#0', 24 => '#1', 25 => '1', 26 => '2', )25 [main 0:main]: 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

array ( 0 => 'def', 1 => 'n', 2 => 'checkleap', 3 => '#0', 4 => '#1', 5 => '1', 6 => '1', 7 => 'or', 8 => 'checkleap', 9 => '#0', 10 => '#1', 11 => '1', 12 => '0', 13 => 'and', 14 => 'nor', 15 => 'capture', 16 => 'nor', 17 => 'empty', 18 => '#0', 19 => 'empty', 20 => '#1', 21 => 'or', 22 => 'checkleap', 23 => '#0', 24 => '#1', 25 => '1', 26 => '2', )26 [main 0:main]: 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

array ( 0 => 'def', 1 => 'ML', 2 => 'merge', 3 => 'merge', 4 => 'leaps', 5 => '#0', 6 => '1', 7 => '0', 8 => 'leaps', 9 => '#0', 10 => '1', 11 => '1', 12 => 'merge', 13 => 'leaps', 14 => '#0', 15 => '2', 16 => '0', 17 => 'leaps', 18 => '#0', 19 => '2', 20 => '2', )27 [main 0:main]: def ML merge merge leaps #0 1 0 leaps #0 1 1 merge leaps #0 2 0 leaps #0 2 2

array ( 0 => 'def', 1 => 'mL', 2 => 'merge', 3 => 'merge', 4 => 'leaps', 5 => '#0', 6 => '1', 7 => '0', 8 => 'leaps', 9 => '#0', 10 => '1', 11 => '1', 12 => 'merge', 13 => 'leaps', 14 => '#0', 15 => '2', 16 => '0', 17 => 'leaps', 18 => '#0', 19 => '2', 20 => '2', )28 [main 0:main]: def mL merge merge leaps #0 1 0 leaps #0 1 1 merge leaps #0 2 0 leaps #0 2 2

array ( 0 => 'sub', 1 => 'postauto1', )29 [main 0:main]: sub postauto1

Syntax Error on line 29

Unknown error concerning the definition of subroutine postauto1.

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

functions

Array ( [isafreedrop] => Array ( [0] => nor [1] => origin [2] => capture ) [N] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 [11] => and [12] => nor [13] => capture [14] => nor [15] => empty [16] => #0 [17] => empty [18] => #1 [19] => or [20] => checkleap [21] => #0 [22] => #1 [23] => 1 [24] => 2 ) [B] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 0 [5] => and [6] => nor [7] => capture [8] => nor [9] => empty [10] => #0 [11] => empty [12] => #1 [13] => or [14] => checkride [15] => #0 [16] => #1 [17] => 1 [18] => 1 ) [R] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => and [6] => nor [7] => capture [8] => nor [9] => empty [10] => #0 [11] => empty [12] => #1 [13] => or [14] => checkride [15] => #0 [16] => #1 [17] => 1 [18] => 0 ) [Q] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkride [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [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] => or [1] => Array ( [0] => == [1] => rankname [2] => #1 [3] => 1 [4] => and [5] => fn [6] => isafreedrop ) [2] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 [11] => or [12] => checkleap [13] => #0 [14] => #1 [15] => 2 [16] => 2 [17] => or [18] => checkleap [19] => #0 [20] => #1 [21] => 2 [22] => 0 ) ) [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] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 [11] => and [12] => nor [13] => capture [14] => nor [15] => empty [16] => #0 [17] => empty [18] => #1 [19] => or [20] => checkleap [21] => #0 [22] => #1 [23] => 1 [24] => 2 ) [b] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 0 [5] => and [6] => nor [7] => capture [8] => nor [9] => empty [10] => #0 [11] => empty [12] => #1 [13] => or [14] => checkride [15] => #0 [16] => #1 [17] => 1 [18] => 1 ) [r] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => and [6] => nor [7] => capture [8] => nor [9] => empty [10] => #0 [11] => empty [12] => #1 [13] => or [14] => checkride [15] => #0 [16] => #1 [17] => 1 [18] => 0 ) [q] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkride [7] => #0 [8] => #1 [9] => 1 [10] => 0 ) [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] => or [1] => Array ( [0] => == [1] => rankname [2] => #1 [3] => 8 [4] => and [5] => fn [6] => isafreedrop ) [2] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 1 [5] => or [6] => checkleap [7] => #0 [8] => #1 [9] => 1 [10] => 0 [11] => or [12] => checkleap [13] => #0 [14] => #1 [15] => 2 [16] => 2 [17] => or [18] => checkleap [19] => #0 [20] => #1 [21] => 2 [22] => 0 ) ) [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] => 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] => merge [2] => leaps [3] => #0 [4] => 1 [5] => 0 [6] => leaps [7] => #0 [8] => 1 [9] => 1 [10] => merge [11] => leaps [12] => #0 [13] => 2 [14] => 0 [15] => leaps [16] => #0 [17] => 2 [18] => 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] => merge [2] => leaps [3] => #0 [4] => 1 [5] => 0 [6] => leaps [7] => #0 [8] => 1 [9] => 1 [10] => merge [11] => leaps [12] => #0 [13] => 2 [14] => 0 [15] => leaps [16] => #0 [17] => 2 [18] => 2 ) )

uservar

Array ( [0] => Array ( [main] => Array ( [k] => e8 [K] => e1 [Drop1] => [Drop2] => [drop1] => [drop2] => [ep] => [wpr] => 2 [bpr] => 7 [fps] => 2 [pzs] => 1 [wcastle] => Array ( [0] => g1 [1] => c1 ) [bcastle] => Array ( [0] => g8 [1] => c8 ) [x] => K [bprom] => Array ( [0] => r [1] => n [2] => b [3] => q [4] => m ) [wprom] => Array ( [0] => M [1] => R [2] => N [3] => B [4] => Q ) ) ) )

mline

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

allmoves

Array ( )

movelist

constants

Array ( )