Quote:
Originally Posted by Cat
Ok. In this case I have a few different which perform operations on the array and as is each one has to get it bit by bit.
Printable View
Quote:
Originally Posted by Cat
Ok. In this case I have a few different which perform operations on the array and as is each one has to get it bit by bit.
What kind of board are you trying to implement?
Something like chess would be perhaps
Start from the top and think about the overall aims of the class and the kind of higher level operations you'll need.Code:enum Piece { none, pawn, rook, /* and so on */ };
class Board
{
public:
Board(void);
// rank is 1 to 8, file is 'a' to 'h' as per normal chess rules
void setPiece( Piece piece, int rank, char file );
Piece getPiece ( int rank, char file );
private:
Piece board[8][8];
};
It was a 15 puzzle board like here. Got it sorted now. Tnx.Quote:
Originally Posted by Salem