public static void displayBoard(final char[][] theBoard) {
// note the final parameter - we won't change the board, just print it.
// Need to format the board display to look like this:
// | |
// -----
// | |
// -----
// | |
System.out.println("Welcome to a game of TicTacToe\nPlayer 1 will go first, and then Player 2 after that.");
for (int row = 0; row < board_size; row++) {
for (int col = 0; col < board_size; col++) {
System.out.print(theBoard[row][col]); // row always comes first in a 2d array
}
System.out.println("| |\n -----\n");
}
}
this is my code. I need to format the board display to look like this:
| |
-----
| |
-----
| |
System.out.println("| |\n -----\n"); makes the table, but is not correct because the Xs and Os just appear before the | | and not inside or to the right of the slots like they are supposed to.