Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Borland > Not understandi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 4 Topic 1032 of 1102
Post > Topic >>

Not understanding these 2 variables

by roofy <rneilen216@[EMAIL PROTECTED] > Jun 2, 2007 at 09:14 AM

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.




 4 Posts in Topic:
Not understanding these 2 variables
roofy <rneilen216@[EMA  2007-06-02 09:14:16 
Re: Not understanding these 2 variables
"Bill Leary" &l  2007-06-02 12:50:30 
Re: Not understanding these 2 variables
roofy <rneilen216@[EMA  2007-06-02 20:58:14 
Re: Not understanding these 2 variables
"bradclark1@[EMAIL P  2007-06-05 07:58:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu May 15 0:11:43 CDT 2008.