i'm building a basic chess program. i set up a class to define each chess piece.
this class contains all the information needed to set up a chess piece and define its location on the board.
the location is stored in the class.
what would be fantastic is if anybody could tell me how to select each piece knowing only its location on the chessgrid.
heres the class definition.
piece(char side, char type, int y, int x);
//Purpose: to set a piece and declare its initial location and type.
//Parameters: init piece type (caps for white), init piece location
void piece::allowed_moves(char board);
//Purpose: based on the location of a piece, the present state of the board and
// the piece type, this calculates the allowable moves for that piece.
//Parameters: type of piece, present location, present board state, alowed moves.
void request_move( int y, int x);
//Purpose: allow the user to select a move from a couple of those already defined.
//Perameters: x, y coordinates.
//Purpose: return the piece type info
//Purpose: return the piece side as an integer
//Returns: -1 for black 1 for white.
void place(char board);
//Purpose: place a piece on the chess board.
//Parameters: chessboard array.
void move(int y, int x, char board);
//Purpose: given a piece location set a new defined location based on allowed moves.
//Parameters: piece location.
void kill(char board);
//Purpose: delete the piece.
void move_check (int g, int h, int a, int b, char c);
char piece_type, piece_side;