The assignment is to create a game of Tic Tac Toe using a two dimensional array. I created the board for the game down below, but now what I'm having issues with is letting the user place X's and O's on the board. I must use a two-dimensional array to represent my board. How can I modify the values so that I can do something like what I have below?
So that this
1 | 2 | 3
----------
4 | 5 | 6
----------
7 | 8 | 9
Can become something like this
X | X | O
----------
4 | 5 | 6
----------
O | 8 | 9
Essentially, I've made the board, how do I make it so that people can play it? Thanks.
public class TicTacToe
{
public static void main( String args[])
{
int [][]board = new int[3][3];
int row =0;
int column =0;
int i=1;
for (row=0;row<board.length; row++)
{
for(column=0;column<board[row].length;column++)
{
board[row][column]= i;
i++;
System.out.print (" "+(board[row][column])+" ");
}
System.out.println();
}
}
}