Syntax Error on line 152

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

Edit the Settings File for Chess with Different Armies: Cylindrical Cinders vs. Amazon Army

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

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 ) [x] => K [bprom] => Array ( [0] => hr [1] => n [2] => b [3] => o ) [wprom] => Array ( [0] => N [1] => B [2] => M ) ) ) [2] => Array ( [checked] => Array ( [subargs] => Array ( [0] => e1 ) [from] => a8 [piece] => hr ) [main] => Array ( [king] => e1 ) ) )

mline

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

allmoves

Array ( )

movelist

constants

Array