const int SIZE = 8; // 8x8 chessboard
const char EMPTY = '_'; // character for empty cell
// display_game(board): Displays chess BOARD as 8x8 character grid
//
void display_game (char board[SIZE][SIZE])
{
cout << "Current board:" << endl;
for (int row = 0; row < SIZE; row++) {
for (int col = 0; col < SIZE; col++) {
int black_score = 0;
int white_score = 0;
int scores[256] = {};
scores['p'] = 1;
scores['P'] = 1;
//.... <--- what am I suppose to do here? scores['q'] = 9;
scores['Q'] = 9;
}
cout << endl;
}
cout << endl;
}
// valid_mode(board, from_row, from_col, to_row, to_col): make sure the move from (from_row, from_col) to (to_row, to_col) makes sense for BOARD
//
bool valid_move (char board[SIZE][SIZE], int from_row, int from_col, int to_row, int to_col)
{
bool valid = false;
while (! valid) {
int from_row = rand() % SIZE;
int from_col = rand() % SIZE;
int to_row = rand() % SIZE;
int to_col = rand() % SIZE;
valid = validate_move(board, from_row, from_col, to_row, to_col);
}
return (valid);
}
// update_board(board, from_row, from_col, to_row, to_col): update BOARD to reflect move from (from_row, from_col) to (to_row, to_col) makes sense for BOARD
//
void update_board (char board[SIZE][SIZE], int from_row, int from_col, int to_row, int to_col)
{
// TODO...
}
// moderate_game(board): reads each move and updates the board accordingly
//
void moderate_game (char board[SIZE][SIZE])
{
// Read while more good input
while (cin.good()) {
char move_type;
// Read the move type letter (C or M)
cout << "Enter next move: ";
cin >> move_type;
// Process the move type
if (cin.eof()) {
// do nothing
}
else if (move_type == 'C') {
string rest;
getline(cin, rest);
cerr << "Ignoring comment (" << rest << ")" << endl;
}
else if (move_type != 'M') {
cout << "Error: Invalid move type (" << move_type << ")" << endl;
}
else {
// Read and validate the starting and ending coordinates
int from_row, from_col, to_row, to_col;
cin >> from_row >> from_col >> to_row >> to_col;
I don't know what else you are trying to do with it. Try to keep you functions simple very direct in task. I don't what the calculations you are doing in it are. They look like they need to be put in a initialization function not a display function.