Originally posted by Cshot
You probably need to modularize your program a bit better. The Move() function should only move the piece and not print it out. You can then call a print board routine after you've moved though.
Sorry I should have been more specific.
Here is my BOARD class declaration:
Code:
class BOARD
{
public:
BOARD();
~BOARD();
void clearBoard();
void showBoard() const;
void setTurn(int t) { turn =t; }
int getTurn() const { return turn;}
bool Move(int,int,int,int);
private:
char board[8][8];
int turn; // 1 = white turn, 2 = black turn
};
Move() takes for 4 values - x1,y1 and x2,y2. They are the initial and final coordinates. All that Move does is make sure the value is valid - a whole crapload of compound boolean statements, pretty much. Whenever the move is invalid, move prints "Invalid move.". If it IS valid, it changes the board[8][8] array accordingly and calls showBoard() and setTurn().
I don't expect there to be a solution like I would like, but I figured I'd ask just in case!