On Jun 2, 12:50 pm, "Bill Leary" <Bill_Le...@[EMAIL PROTECTED]
> wrote:
> "roofy" <rneilen...@[EMAIL PROTECTED]
> wrote in message
>
> news:1180800856.979324.321980@[EMAIL PROTECTED]
>
> I'm a little rusty on Pascal, but let's have a go...
>
> > What I do not understand in the first variable is the = (PAWN, ROOK,
> > KNIGHT ...etc. How could one variable equal another undefined variable
> > not to mention that their are six undefined variables that point to
> > PieceImageType.
>
> It's not a variable, it's a defining a new data type. One which can
have
> one of six values, those values being PAWN, ROOK, and so on.
>
> In C:
>
> enum PieceImageType {PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING};
>
> > The second defined variable is that I do not
> > understand the concept of how the programmer was defining
> > PossibleMoves as an array. If I understand correctly, when defining an
> > array, the part that is inside the brackets is what defines the size
> > of the array.
>
> I'm assuming that the PossibleMoveType as in the Type section along with
> PieceImageType rather than the Var section.
>
> So, it's defining a type PossibleMoveType which is a six element array
with
> indexes PAWN, ROOK, and so on.
>
> And, later there should be something like
>
> Var Moves: PossibleMoveType;
>
> which would then permit, in the code section:
>
> Moves[ROOK].NumDirections := 3;
> Moves[KING].UnitMove[3].DirRow := -1;
>
> or there might be:
>
> ThisPiece: PieceImageType;
>
> in the Var section, allowing this usage in the code section:
>
> ThisPiece := BISHOP;
>
> if Moves[ThisPiece].MaxDistance = 3 then
>
> and so on.
>
> - Bill
Bill,
You make everything so clear. Thank you. You are the man.


|