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.
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]; };
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
It was a 15 puzzle board like here. Got it sorted now. Tnx.Originally Posted by Salem