08-02-2012, 10:49 PM
The problem lies in function ChooseNextUnit()
The FOR loop is using NumsUnitIter as a variable, but it's already declared globally as a const.
You should add the line
within the function body, so the compiler will understand you want to override the global constant using the same name for a local variable (the global constant NumUnitsIter won't be available within the function). The compiler won't override (declare) the local variable within the function for you (at the moment).
This is a compiler bug, anyway: it should either stop with an error, or issue a warning "Inner declaration hides global constant", or the like. I will fix it later.
Code:
const NumUnitsIter as Ubyte = 29
Function ChooseNextUnit() as byte
if LastColorToMove=0 then
LastColorToMove=red
end if
for NumUnitsIter =1 to NumUnits 'NumUnitsIter is a global constant!
if ActionPoints(NumUnitsIter)=3 then
UnitMoving=NumUnitsIter
Exit for
end if
next
end function
The FOR loop is using NumsUnitIter as a variable, but it's already declared globally as a const.
You should add the line
Code:
Dim NumUnitsIter as Ubyte
This is a compiler bug, anyway: it should either stop with an error, or issue a warning "Inner declaration hides global constant", or the like. I will fix it later.