Hi,
I found a website that had some code for a chess game. The game is
written in Borland Turbo Pascal 5.5. I have to admit though, I am a C+
+ programmer and do not know much about Turbo Pascal, not to mention
that I do not have the Turbo Pascal compiler.
Why I have downloaded the files, is because what I am looking to do
is mostly seeing how the game works, and apply my skills of C++ to
create my own chess game. However, I am having some troubles
understanding these 2 defined variables in the chess program, which I
cannot seem to find help in on the internet.
The first variable is this...
Type PieceImageType = (PAWN, ROOK, KNIGHT, BISHOP, QUEEN, KING);
The second variable is this...
PossibleMovesType = array [PieceImageType] of record
NumDirections : 1..8;
MaxDistance : 1..7;
UnitMove : array [1..8] of record
DirRow, DirCol: -2..2;
end;
end;
.... now before you answer, let me explain what I do not understand.
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. 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. However, how could array[PieceImageType] define the size
of the array if PieceImageType is defined as something that I have no
clue on.
I thought Turbo Pascal is suppose to be easy. In my opinion, C++ is
easier. At least for one thing, in C++, all variables must be defined
and seeing that they are defined tells the programmer what the
variable will hold.


|