I am learning to work with 2D arrays and was tasked with creating a 5x5 game board with different values on the side with the middle row having two pieces on each side of an empty space totaling twelve pieces each.
However I can't figure out the logic to switch characters in the middle
grid = new char[ROWS][COLS];
//initialize to starting configuration
char frogs = 'F';
for (int i = 0; i < ROWS; i++){
for (int j = 0; j < COLS; j++){
grid[i][j] = frogs;
}
}
char toads = 'T';
for (int i = ROWS -3; i < ROWS; i++){
for (int j = 0; j < COLS; j++){
grid[i][j] = toads;
}
}
grid[ROWS - 3][COLS - 3] = EMPTY_SPACE;