Syntax Error on line 46

The function 'e' has not been defined. Its arguments are f9 g2

Edit the Settings File for Boardroom 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 setsystem maxmove 2
   1 ban commands allmoves
   2 allow moves 1 captures 1 promotions 2
   3 set wking f1
   4 set bking f10
   5 set epfrom false
   6 set epto false
   7 set wacastl true
   8 set wkcastl true
   9 set bacastl true
  10 set bkcastl true
  11 def N checkleap #0 #1 1 2
  12 def C checkleap #0 #1 1 3
  13 def R checkride #0 #1 0 1
  14 def B checkride #0 #1 1 1
  15 def W fn N #0 #1 or fn C #0 #1
  16 def Q fn B #0 #1 or fn R #0 #1
  17 def K checkleap #0 #1 1 1 or checkleap #0 #1 0 1
  18 def n checkleap #0 #1 1 2
  19 def c checkleap #0 #1 1 3
  20 def r checkride #0 #1 0 1
  21 def b checkride #0 #1 1 1
  22 def w fn N #0 #1 or fn C #0 #1
  23 def q fn B #0 #1 or fn R #0 #1
  24 def k checkleap #0 #1 1 1 or checkleap #0 #1 0 1
  25 sub attacked sq
  26   local pawn pdir from piece bywhite
  27   if > count var subargs 1
  28     set bywhite elem 1 subargs
  29   else
  30     set bywhite islower space #sq
  31   endif
  32   if #bywhite
  33     def enemies onlyupper
  34     set pawn P
  35     set pdir 1
  36   else
  37     def enemies onlylower
  38     set pawn p
  39     set pdir -1
  40   endif
  41   for (from piece) fn enemies
  42     if == #piece #pawn
  43       if checkleap #from #sq -1 #pdir or checkleap #from #sq 1 #pdir
  44         return #from
  45       endif
  46     elseif fn #piece #from #sq
  47       return #from
  48     endif
  49   next
  50   return false
  51 endsub
  52 sub checkpawn pdir
  53   if checkaride origin dest 0 #pdir
  54     if != old @
  55       die "A pawn may not capture with an orthogonal move."
  56     endif
  57     if == dest where origin 0 #pdir
  58       set epto false
  59     else
  60       if cond > #pdir 0 >= rank dest 5 < rank dest 5
  61         die "A pawn cannot multistep into the opponent's half of the board."
  62       endif
  63       set epfrom origin
  64       set epto dest
  65     endif
  66   elseif checkaleap origin dest 1 #pdir or checkaleap origin dest -1 #pdir
  67     if == old @
  68       if == file dest file #epto and #epto
  69         my d f t
  70         set d rank dest
  71         set f rank #epfrom
  72         set t rank #epto
  73         if > #d #f and < #d #t or and < #d #f > #d #t
  74           capture #epto
  75         else
  76           die "An ep-capture must go to a square leaped by the captured pawn."
  77         endif
  78       else
  79         die "A pawn must capture when moving diagonally."
  80       endif
  81     endif
  82     set epto false
  83   else
  84     die "A pawn may not move that way."
  85   endif
  86   if == rank dest 9
  87     if not match space dest Q W
  88       die "A pawn promotes to Queen or Wildebeest of the same color."
  89     endif
  90   elseif == rank dest 0
  91     if not match space dest q w
  92       die "A pawn promotes to Queen or Wildebeest of the same color."
  93     endif
  94   elseif != space dest moved
  95     die "A pawn promotes on the final row only."
  96   endif
  97 endsub
  98 sub checknotpawn
  99   if not fn moved origin dest
 100     die "This piece cannot move that way."
 101   endif
 102   if == moved K
 103     set wking dest
 104   elseif == moved k
 105     set bking dest
 106   endif
 107   set epto false
 108 endsub
 109 def isKINGc == #2 K and == #0 f1  and match #1 a1 b1 c1 d1 h1 i1 j1 k1
 110 def iskingc == #2 k and == #0 f10 and match #1 a10 b10 c10 d10 h10 i10 j10 k10
 111 def isROOKc == #2 R and == #3 K and == #1 f1  and match #0 a1 k1
 112 def isrookc == #2 r and == #3 k and == #1 f10 and match #0 a10 k10
 113 sub checkkcastl acastl kcastl
 114   my rf rt a byw sq x i
 115   set a < file dest file origin
 116   if not cond #a #acastl #kcastl
 117     die "This castling move is not possible any more."
 118   endif
 119   if match dest a1 k1 a10 k10
 120     die "The King may only move up to four steps when castling."
 121   endif
 122   if != old @
 123     die "You may not capture when castling."
 124   endif
 125   set x cond #a -1 1
 126   for i range 1 4
 127     set sq where origin * #x #i 0
 128     if != space #sq @ and != #sq dest
 129       die "You may not castle over intervening pieces."
 130     endif
 131   next
 132   set byw == moved k
 133   set sq origin
 134   do
 135     if sub attacked #sq #byw
 136       die "You may not castle out of or through check."
 137     endif
 138     set sq where #sq #x 0
 139   loop until == #sq dest
 140   if #byw
 141     set bking dest
 142   else
 143     set wking dest
 144   endif
 145   set rf where origin cond #a -5 5 0
 146   set rt where dest cond #a 1 -1 0
 147   move #rf #rt
 148   set epto false
 149 endsub
 150 sub checkrcastl acastl kcastl
 151   my kt a king wc
 152   set a > file dest file origin
 153   if not cond #a #acastl #kcastl
 154     die "This castling move is not possible any more."
 155   endif
 156   if not checkride origin dest 1 0
 157     die "You may not castle over intervening pieces."
 158   endif
 159   if sub attacked dest
 160     die "You may not castle out of check."
 161   endif
 162   set wc == moved R
 163   set king cond #wc K k
 164   set kt where dest cond #a -1 1 0
 165   add #king #kt
 166   if #wc
 167     set wking #kt
 168   else
 169     set bking #kt
 170   endif
 171   set epto false
 172 endsub
 173 def P < rank #1 rank var epfrom and > rank #1 rank var epto
and == file var epto file #1 and checkleap #0 #1 1 1 and var epto
or and < rank #1 5 checkaride #0 #1 0 1
or checkaleap #0 #1 0 1 and empty #1
or and not empty #1 checkleap #0 #1 1 1 and > rank #1 rank #0
 174 def p > rank #1 rank var epfrom and < rank #1 rank var epto
and == file var epto file #1 and checkleap #0 #1 1 1 and var epto
or and >= rank #1 5 checkaride #0 #1 0 -1
or checkaleap #0 #1 0 -1 and empty #1
or and not empty #1 checkleap #0 #1 1 1 and < rank #1 rank #0
 175 def NL leaps #0 1 2
 176 def CL leaps #0 1 3
 177 def RL rays #0 1 0
 178 def BL rays #0 1 1
 179 def QL merge rays #0 1 0 rays #0 1 1
 180 def WL merge leaps #0 1 2 leaps #0 1 3
 181 def KL merge leaps #0 1 1 leaps #0 1 0
 182 def PL array where #0 0 3 where #0 0 2 where #0 0 1 where #0 -1 1 where #0 1 1
 183 def pL array where #0 0 -3 where #0 0 -2 where #0 0 -1 where #0 -1 -1 where #0 1 -1
 184 def nL leaps #0 1 2
 185 def cL leaps #0 1 3
 186 def rL rays #0 1 0
 187 def bL rays #0 1 1
 188 def qL merge rays #0 1 0 rays #0 1 1
 189 def wL merge leaps #0 1 2 leaps #0 1 3
 190 sub stalemated kingpos
 191   local from piece to incheck
 192   if isupper space #kingpos
 193     def friends onlyupper
 194     def friend isupper #0
 195   else
 196     def friends onlylower
 197     def friend islower #0
 198   endif
 199   store
 200   for to fn KL #kingpos
 201     if not fn friend space #to
 202       move #kingpos #to
 203       set incheck sub attacked #to
 204       restore
 205       verify #incheck
 206     endif
 207   next
 208   for (from piece) fn friends
 209     if == #from #kingpos
 210       continue
 211     endif
 212     for to fn join #piece L #from
 213       if fn #piece #from #to and not fn friend space #to and onboard #to
 214         if != file #from file #to and empty #to
and == toupper #piece P and #epto
 215           capture #epto
 216         endif
 217         move #from #to
 218         set incheck sub attacked #kingpos
 219         restore
 220         verify #incheck
 221       endif
 222     next
 223   next
 224   return true
 225 endsub
 226 sub postauto1
 227   if not isupper moved
 228     die "There is no piece of yours."
 229   endif
 230   if != moved space dest and != moved P
 231     die "You may not change type or color of this piece."
 232   endif
 233   if fn isKINGc origin dest moved
 234     gosub checkkcastl #wacastl #wkcastl
 235     set wacastl false
 236     set wkcastl false
 237   elseif fn isROOKc origin dest moved old
 238     gosub checkrcastl #wacastl #wkcastl
 239     set wacastl false
 240     set wkcastl false
 241   else
 242     if isupper old
 243       die "You may not capture your own pieces."
 244     endif
 245     if == moved P
 246       gosub checkpawn 1
 247     else
 248       gosub checknotpawn
 249       if == origin a1 or == origin f1
 250         set wacastl false
 251       endif
 252       if == origin k1 or == origin f1
 253         set wkcastl false
 254       endif
 255     endif
 256     if == dest a10
 257       set bacastl false
 258     endif
 259     if == dest k10
 260       set bkcastl false
 261     endif
 262   endif
 263   local a
 264   set a sub attacked #wking
 265   if #a
 266     die "Your King is attacked by " #a
 267   endif
 268 endsub
 269 sub postauto2
 270   if not islower moved
 271     die "There is no piece of yours."
 272   endif
 273   if != moved space dest and != moved p
 274     die "You may not change type or color of this piece."
 275   endif
 276   if fn iskingc origin dest moved
 277     gosub checkkcastl #bacastl #bkcastl
 278     set bacastl false
 279     set bkcastl false
 280   elseif fn isrookc origin dest moved old
 281     gosub checkrcastl #bacastl #bkcastl
 282     set bacastl false
 283     set bkcastl false
 284   else
 285     if islower old
 286       die "You may not capture your own pieces."
 287     endif
 288     if == moved p
 289       gosub checkpawn -1
 290     else
 291       gosub checknotpawn
 292       if == origin a10 or == origin f10
 293         set bacastl false
 294       endif
 295       if == origin k10 or == origin f10
 296         set bkcastl false
 297       endif
 298     endif
 299     if == dest a1
 300       set wacastl false
 301     endif
 302     if == dest k1
 303       set wkcastl false
 304     endif
 305   endif
 306   local a
 307   set a sub attacked #bking
 308   if #a
 309     die "Your King is attacked by " #a
 310   endif
 311 endsub
 312 if sub stalemated #wking
 313   if sub attacked #wking
 314     say "Checkmate! Black has won!"
 315   else
 316     say "Stalemate! Black has won!"
 317   endif
 318   won
 319 elseif sub attacked #wking
 320   say "Check!"
 321 elseif == 1 count onlyupper and == 1 count onlylower
 322   say "No side can win any more. Game drawn."
 323   drawn
 324 endif
 325 end
 326 

functions

Array ( [N] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 2 ) [C] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 3 ) [R] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [B] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [W] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => C [7] => #0 [8] => #1 ) [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] => 0 [10] => 1 ) [n] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 2 ) [c] => Array ( [0] => checkleap [1] => #0 [2] => #1 [3] => 1 [4] => 3 ) [r] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 0 [4] => 1 ) [b] => Array ( [0] => checkride [1] => #0 [2] => #1 [3] => 1 [4] => 1 ) [w] => Array ( [0] => fn [1] => N [2] => #0 [3] => #1 [4] => or [5] => fn [6] => C [7] => #0 [8] => #1 ) [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] => 0 [10] => 1 ) [isKINGc] => Array ( [0] => == [1] => #2 [2] => K [3] => and [4] => == [5] => #0 [6] => f1 [7] => and [8] => match [9] => #1 [10] => a1 [11] => b1 [12] => c1 [13] => d1 [14] => h1 [15] => i1 [16] => j1 [17] => k1 ) [iskingc] => Array ( [0] => == [1] => #2 [2] => k [3] => and [4] => == [5] => #0 [6] => f10 [7] => and [8] => match [9] => #1 [10] => a10 [11] => b10 [12] => c10 [13] => d10 [14] => h10 [15] => i10 [16] => j10 [17] => k10 ) [isROOKc] => Array ( [0] => == [1] => #2 [2] => R [3] => and [4] => == [5] => #3 [6] => K [7] => and [8] => == [9] => #1 [10] => f1 [11] => and [12] => match [13] => #0 [14] => a1 [15] => k1 ) [isrookc] => Array ( [0] => == [1] => #2 [2] => r [3] => and [4] => == [5] => #3 [6] => k [7] => and [8] => == [9] => #1 [10] => f10 [11] => and [12] => match [13] => #0 [14] => a10 [15] => k10 ) [P] => Array ( [0] => < [1] => rank [2] => #1 [3] => rank [4] => var [5] => epfrom [6] => and [7] => > [8] => rank [9] => #1 [10] => rank [11] => var [12] => epto [13] => and [14] => == [15] => file [16] => var [17] => epto [18] => file [19] => #1 [20] => and [21] => checkleap [22] => #0 [23] => #1 [24] => 1 [25] => 1 [26] => and [27] => var [28] => epto [29] => or [30] => and [31] => < [32] => rank [33] => #1 [34] => 5 [35] => checkaride [36] => #0 [37] => #1 [38] => 0 [39] => 1 [40] => or [41] => checkaleap [42] => #0 [43] => #1 [44] => 0 [45] => 1 [46] => and [47] => empty [48] => #1 [49] => or [50] => and [51] => not [52] => empty [53] => #1 [54] => checkleap [55] => #0 [56] => #1 [57] => 1 [58] => 1 [59] => and [60] => > [61] => rank [62] => #1 [63] => rank [64] => #0 ) [p] => Array ( [0] => > [1] => rank [2] => #1 [3] => rank [4] => var [5] => epfrom [6] => and [7] => < [8] => rank [9] => #1 [10] => rank [11] => var [12] => epto [13] => and [14] => == [15] => file [16] => var [17] => epto [18] => file [19] => #1 [20] => and [21] => checkleap [22] => #0 [23] => #1 [24] => 1 [25] => 1 [26] => and [27] => var [28] => epto [29] => or [30] => and [31] => >= [32] => rank [33] => #1 [34] => 5 [35] => checkaride [36] => #0 [37] => #1 [38] => 0 [39] => -1 [40] => or [41] => checkaleap [42] => #0 [43] => #1 [44] => 0 [45] => -1 [46] => and [47] => empty [48] => #1 [49] => or [50] => and [51] => not [52] => empty [53] => #1 [54] => checkleap [55] => #0 [56] => #1 [57] => 1 [58] => 1 [59] => and [60] => < [61] => rank [62] => #1 [63] => rank [64] => #0 ) [NL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 2 ) [CL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 3 ) [RL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [BL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [QL] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [WL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 2 [5] => leaps [6] => #0 [7] => 1 [8] => 3 ) [KL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 1 [5] => leaps [6] => #0 [7] => 1 [8] => 0 ) [PL] => Array ( [0] => array [1] => where [2] => #0 [3] => 0 [4] => 3 [5] => where [6] => #0 [7] => 0 [8] => 2 [9] => where [10] => #0 [11] => 0 [12] => 1 [13] => where [14] => #0 [15] => -1 [16] => 1 [17] => where [18] => #0 [19] => 1 [20] => 1 ) [pL] => Array ( [0] => array [1] => where [2] => #0 [3] => 0 [4] => -3 [5] => where [6] => #0 [7] => 0 [8] => -2 [9] => where [10] => #0 [11] => 0 [12] => -1 [13] => where [14] => #0 [15] => -1 [16] => -1 [17] => where [18] => #0 [19] => 1 [20] => -1 ) [nL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 2 ) [cL] => Array ( [0] => leaps [1] => #0 [2] => 1 [3] => 3 ) [rL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 0 ) [bL] => Array ( [0] => rays [1] => #0 [2] => 1 [3] => 1 ) [qL] => Array ( [0] => merge [1] => rays [2] => #0 [3] => 1 [4] => 0 [5] => rays [6] => #0 [7] => 1 [8] => 1 ) [wL] => Array ( [0] => merge [1] => leaps [2] => #0 [3] => 1 [4] => 2 [5] => leaps [6] => #0 [7] => 1 [8] => 3 ) [friends] => Array ( [0] => onlylower ) [friend] => Array ( [0] => islower [1] => #0 ) [enemies] => Array ( [0] => onlylower ) )

uservar

Array ( [0] => Array ( [main] => Array ( [wking] => f1 [bking] => f10 [epfrom] => [epto] => [wacastl] => 1 [wkcastl] => 1 [bacastl] => 1 [bkcastl] => 1 ) ) [2] => Array ( [stalemated] => Array ( [subargs] => Array ( [0] => f1 ) ) [main] => Array ( [kingpos] => f1 [from] => 0 [piece] => 0 [to] => g2 [incheck] => 0 ) ) [5] => Array ( [attacked] => Array ( [subargs] => Array ( [0] => g2 ) ) [main] => Array ( [sq] => g2 [pawn] => p [pdir] => -1 [from] => f9 [piece] => e [bywhite] => ) ) )

mline

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

allmoves

Array ( )

movelist

constants

Array ( )