Syntax Error on line 4

Unknown error concerning the definition of subroutine postauto1.

Edit the Settings File for Alice 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 setflag a1 a8 h1 h8 e1 e8
   1 set k e8
   2 set K e1
   3 set ep null
   4 sub postauto1
   5   set file filename dest
   6   if not samecase #file filename origin
   7     die Your move must be made on a single board. Moving to the other board is handled by automation.
   8   endif
   9   if isupper old
  10     die You may not capture your own pieces.
  11   endif
  12   set newdest join cond islower #file toupper #file tolower #file rankname dest
  13   if not empty #newdest
  14     die You may not move to a space whose counterpart is occupied.
  15   endif
  16   if not equal moved P
  17     set ep null
  18     if unequal space dest moved
  19       die You may not change the type of this piece.
  20     endif
  21   endif
  22   set legal false
  23   if equal moved P
  24     if equal file origin file dest
  25       if capture
  26         die A Pawn may not capture when it moves straight.
  27       endif
  28       set legal checkaleap origin dest 0 1
  29       if var legal
  30         set ep null
  31       else
  32         set legal and equal rankname origin 2 checkatwostep origin dest 0 1 0 1
  33         set ep toupper dest
  34       endif
  35     elseif or capture equal rankname origin 5
  36       set legal or checkaleap origin dest neg 1 1 checkaleap origin dest 1 1
  37       if and var legal not capture
  38         set cd join filename dest 5
  39         set legal equal var cd var ep
  40         if var legal
  41           capture #ep
  42         endif
  43       endif
  44       set ep null
  45     endif 2
  46     if nor equal space dest moved equal rankname dest 8
  47       die You may not promote a Pawn that is not on your last rank.
  48     endif
  49     if equal rankname dest 8
  50       if equal P space dest
  51         die You must promote a Pawn when it reaches your last rank.
  52       elseif not match space dest Q R B N
  53         set np space dest
  54         die You may not promote your Pawn to a #np
  55       endif 2
  56     endif
  57   elseif equal moved N
  58     set legal checkleap origin dest 1 2
  59   elseif equal moved B
  60     set legal checkride origin dest 1 1
  61   elseif equal moved R
  62     set legal checkride origin dest 1 0
  63     if var legal
  64       unsetflag origin
  65     endif
  66   elseif equal moved Q
  67     set legal or checkride origin dest 1 1 checkride origin dest 1 0
  68   elseif equal moved K
  69     set legal or checkleap origin dest 1 1 checkleap origin dest 1 0
  70     if and equal origin e1 match dest c1 g1
  71       if not flag e1
  72         die You can't castle, because you have already moved your King
  73       endif
  74       if match p space d2 space f2
  75       elseif match n space c2 space d3 space f3 space g2
  76       elseif match insight e1 neg 1 0 r q
  77       elseif match insight e1 0 1 r q
  78       elseif match insight e1 1 0 r q
  79       elseif match insight e1 neg 1 1 b q
  80       elseif match insight e1 1 1 b q
  81       elseif match k space d2 space e2 space f2
  82       else
  83         set legal true
  84       endif 8
  85       if not var legal
  86         die You can't castle when you're in check
  87       endif
  88       set legal false
  89       if equal dest g1
  90         if anyfalse flag h1 empty f1 not capture
  91         elseif match p space e2 space g2
  92         elseif match n space d2 space e3 space g3 space h2
  93         elseif match insight f1 0 1 r q
  94         elseif match insight f1 neg 1 1 b q
  95         elseif match insight f1 1 1 b q
  96         else
  97           set legal true
  98           unsetflag h1
  99           move h1 f1
 100         endif 6
 101       else
 102         if anyfalse flag a1 empty b1 empty d1 not capture
 103         elseif match p space c2 space e2
 104         elseif match n space f2 space e3 space c3 space b2 space f2
 105         elseif match insight d1 0 1 r q
 106         elseif match insight d1 neg 1 1 b q
 107         elseif match insight d1 1 1 b q
 108         else
 109           set legal true
 110           unsetflag a1
 111           move a1 d1
 112         endif 6
 113       endif
 114       if not var legal
 115         die You can't castle to dest
 116       endif
 117     endif
 118     unsetflag e1
 119     set K dest
 120   endif all
 121   if not var legal
 122     die You may not move a moved from origin to dest
 123   endif
 124   if equal moved K
 125     set legal false
 126     if match p what #K 1 1 what #K neg 1 1
 127     elseif match n what #K 1 2 what #K neg 1 2 what #K 1 neg 2 what #K neg 1 neg 2
 128     elseif match n what #K 2 1 what #K neg 2 1 what #K 2 neg 1 what #K neg 2 neg 1
 129     elseif match insight #K 0 neg 1 r q
 130     elseif match insight #K neg 1 0 r q
 131     elseif match insight #K 0 1 r q
 132     elseif match insight #K 1 0 r q
 133     elseif match insight #K neg 1 neg 1 b q
 134     elseif match insight #K neg 1 1 b q
 135     elseif match insight #K 1 neg 1 b q
 136     elseif match insight #K 1 1 b q
 137     elseif match k what #K 1 neg 1 what #K what 1 0 what #K 1 1 what #K 0 1
 138     elseif match k what #K neg 1 neg 1 what #K what neg 1 0 what #K neg 1 1 what #K 0 neg 1
 139     else
 140       set legal true
 141     endif all
 142     if not var legal
 143       die You may not move into check
 144     endif
 145     move dest #newdest
 146     if equal K space #newdest
 147       set K #newdest
 148       if equal origin e1
 149         if equal #K G1
 150           move f1 F1
 151         elseif equal #K c1
 152           move c1 C1
 153         endif 2
 154       endif
 155     endif
 156     set legal false
 157     if match p what #K 1 1 what #K neg 1 1
 158     elseif match n what #K 1 2 what #K neg 1 2 what #K 1 neg 2 what #K neg 1 neg 2
 159     elseif match n what #K 2 1 what #K neg 2 1 what #K 2 neg 1 what #K neg 2 neg 1
 160     elseif match insight #K 0 neg 1 r q
 161     elseif match insight #K neg 1 0 r q
 162     elseif match insight #K 0 1 r q
 163     elseif match insight #K 1 0 r q
 164     elseif match insight #K neg 1 neg 1 b q
 165     elseif match insight #K neg 1 1 b q
 166     elseif match insight #K 1 neg 1 b q
 167     elseif match insight #K 1 1 b q
 168     elseif match k what #K 1 neg 1 what #K what 1 0 what #K 1 1 what #K 0 1
 169     elseif match k what #K neg 1 neg 1 what #K what neg 1 0 what #K neg 1 1 what #K 0 neg 1
 170     else
 171       set legal true
 172     endif all
 173     if not var legal
 174       die You may not move into check
 175     endif
 176   endsub
 177   sub postauto2
 178     set file filename dest
 179     if not samecase #file filename origin
 180       die Your move must be made on a single board. Moving to the other board is handled by automation.
 181     endif
 182     if islower old
 183       die You may not capture your own pieces.
 184     endif
 185     set newdest join cond islower #file toupper #file tolower #file rankname dest
 186     if not empty #newdest
 187       die You may not move to a space whose counterpart is occupied.
 188     endif
 189     if not equal moved p
 190       set ep null
 191       if unequal space dest moved
 192         die You may not change the type of this piece.
 193       endif
 194     endif
 195     set legal false
 196     if equal moved p
 197       if equal file origin file dest
 198         if capture
 199           die A Pawn may not capture when it moves straight.
 200         endif
 201         set legal checkaleap origin dest 0 neg 1
 202         if var legal
 203           set ep null
 204         else
 205           set legal and equal rankname origin 7 checkatwostep origin dest 0 neg 1 0 neg 1
 206           set ep toupper dest
 207         endif
 208       elseif or capture equal rankname origin 4
 209         set legal or checkaleap origin dest neg 1 neg 1 checkaleap origin dest 1 neg 1
 210         if and var legal not capture
 211           set cd join filename dest 4
 212           set legal equal var cd var ep
 213           if var legal
 214             capture #ep
 215           endif
 216         endif
 217         set ep null
 218       endif 2
 219       if nor equal space dest moved equal rankname dest 1
 220         die You may not promote a Pawn that is not on your last rank.
 221       endif
 222       if equal rankname dest 1
 223         if equal p space dest
 224           die You must promote a Pawn when it reaches your last rank.
 225         elseif not match space dest q r b n
 226           set np space dest
 227           die You may not promote your Pawn to a #np
 228         endif 2
 229       endif
 230     elseif equal moved n
 231       set legal checkleap origin dest 1 2
 232     elseif equal moved b
 233       set legal checkride origin dest 1 1
 234     elseif equal moved r
 235       set legal checkride origin dest 1 0
 236       if var legal
 237         unsetflag origin
 238       endif
 239     elseif equal moved q
 240       set legal or checkride origin dest 1 1 checkride origin dest 1 0
 241     elseif equal moved k
 242       set legal or checkleap origin dest 1 1 checkleap origin dest 1 0
 243       if and equal origin e8 match dest c8 g8
 244         if not flag e8
 245           die You can't castle, because you have already moved your King
 246         endif
 247         if match P space d7 space f7
 248         elseif match N space c7 space d6 space f6 space g7
 249         elseif match insight e8 neg 1 0 R Q
 250         elseif match insight e8 0 neg 1 R Q
 251         elseif match insight e8 1 0 R Q
 252         elseif match insight e8 neg 1 neg 1 B Q
 253         elseif match insight e8 1 neg 1 B Q
 254         elseif match K space d7 space e7 space f7
 255         else
 256           set legal true
 257         endif 8
 258         if not var legal
 259           die You can't castle when you're in check
 260         endif
 261         set legal false
 262         if equal dest g8
 263           if anyfalse flag h8 empty f8 not capture
 264           elseif match P space e7 space g7
 265           elseif match N space d7 space e6 space g6 space h7
 266           elseif match insight f8 0 neg 1 R Q
 267           elseif match insight f8 neg 1 neg 1 B Q
 268           elseif match insight f8 1 neg 1 B Q
 269           else
 270             set legal true
 271             unsetflag h8
 272             move h8 f8
 273           endif 6
 274         else
 275           if anyfalse flag a8 empty b8 empty d8 not capture
 276           elseif match P space c7 space e7
 277           elseif match N space f7 space e6 space c6 space b7 space f7
 278           elseif match insight d8 0 neg 1 R Q
 279           elseif match insight d8 neg 1 neg 1 B Q
 280           elseif match insight d8 1 neg 1 B Q
 281           else
 282             set legal true
 283             unsetflag a8
 284             move a8 d8
 285           endif 6
 286         endif
 287         if not var legal
 288           die You may not castle to dest
 289         endif
 290       endif
 291       unsetflag e8
 292       set k dest
 293     endif all
 294     if not var legal
 295       die You may not move a moved from origin to dest
 296     endif
 297     if equal moved k
 298       set legal false
 299       if match P what #k 1 neg 1 what #k neg 1 neg 1
 300       elseif match N what #k 1 2 what #k neg 1 2 what #k 1 neg 2 what #k neg 1 neg 2
elseif match N what #k 2 1 what #k neg 2 1 what #k 2 neg 1 what #k neg 2 neg 1
 301       elseif match insight #k 0 neg 1 R Q
 302       elseif match insight #k neg 1 0 R Q
 303       elseif match insight #k 0 1 R Q
 304       elseif match insight #k 1 0 R Q
 305       elseif match insight #k neg 1 neg 1 B Q
 306       elseif match insight #k neg 1 1 B Q
 307       elseif match insight #k 1 neg 1 B Q
 308       elseif match insight #k 1 1 B Q
 309       elseif match K what #k 1 neg 1 what #k what 1 0 what #k 1 1 what #k 0 1
 310       elseif match K what #k neg 1 neg 1 what #k what neg 1 0 what #k neg 1 1 what #k 0 neg 1
 311       else
 312         set legal true
 313       endif all
 314       if not var legal
 315         die You may not move into check
 316       endif
 317       move dest #newdest
 318       if equal k space #newdest
 319         set k #newdest
 320         if equal origin e8
 321           if equal #k G8
 322             move f8 F8
 323           elseif equal #k c8
 324             move c8 C8
 325           endif 2
 326         endif
 327       endif
 328       set legal false
 329       if match P what #k 1 neg 1 what #k neg 1 neg 1
 330       elseif match N what #k 1 2 what #k neg 1 2 what #k 1 neg 2 what #k neg 1 neg 2
elseif match N what #k 2 1 what #k neg 2 1 what #k 2 neg 1 what #k neg 2 neg 1
 331       elseif match insight #k 0 neg 1 R Q
 332       elseif match insight #k neg 1 0 R Q
 333       elseif match insight #k 0 1 R Q
 334       elseif match insight #k 1 0 R Q
 335       elseif match insight #k neg 1 neg 1 B Q
 336       elseif match insight #k neg 1 1 B Q
 337       elseif match insight #k 1 neg 1 B Q
 338       elseif match insight #k 1 1 B Q
 339       elseif match K what #k 1 neg 1 what #k what 1 0 what #k 1 1 what #k 0 1
 340       elseif match K what #k neg 1 neg 1 what #k what neg 1 0 what #k neg 1 1 what #k 0 neg 1
 341       else
 342         set legal true
 343       endif all
 344       if not var legal
 345         die You may not move into check
 346       endif
 347     endsub
 348     end
 349     

functions

uservar

Array ( [0] => Array ( [main] => Array ( [k] => e8 [K] => e1 [ep] => ) ) )

mline

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

allmoves

Array ( )

movelist

constants

Array ( )