home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_10
/
1010109a
< prev
next >
Wrap
Text File
|
1992-08-10
|
1KB
|
59 lines
#ifndef GAME_H
#define GAME_H
typedef enum { PAWN, BISHOP, ROOK, KING } GAME_PIECE;
typedef struct {
int vertical;
} PAWN_MOVE_STRUCT;
typedef PAWN_MOVE_STRUCT *PAWN_MOVE;
typedef struct {
int diagonal;
} BISHOP_MOVE_STRUCT;
typedef BISHOP_MOVE_STRUCT *BISHOP_MOVE;
typedef struct {
int vertical;
int horizontal;
} ROOK_MOVE_STRUCT;
typedef ROOK_MOVE_STRUCT *ROOK_MOVE;
typedef struct {
int vertical;
int horizontal;
int diagonal;
} KING_MOVE_STRUCT;
typedef KING_MOVE_STRUCT *KING_MOVE;
typedef union {
PAWN_MOVE PawnM;
BISHOP_MOVE BishopM;
ROOK_MOVE RookM;
KING_MOVE KingM;
} MOVE_U;
typedef MOVE_U *MOVE;
class piece {
public:
piece (); // constructor and destructor have the
~piece (); // same name as the class.
piece_position (); // declaration of public interfaces to
pawn_move (); // the class piece.
bishop_move ();
rook_move ();
king_move ();
private:
GAME_PIECE piece_type; // private data for the class
MOVE move; // piece. Can only be accessed
int x_coord; // through encapsulated member
int y_coord; // functions or friends.
};
#endif // GAME_H