good afternoon everyone. i have been working on a tictactoe game using arrays and if statements and loops. my problem is the game exits when i type in row 0 and column 0. also i was wondering if you could help me change the input method so that the user could type in like 1 and it would place an x or an o in the box. also i just noticed it doesn't stop when you have three in a row
import java.util.Scanner; /** This program runs a TicTacToe game. It prompts the user to set positions on the board and prints out the result. */ public class TicTacToeRunner { public static void main(String[] args) { Scanner in = new Scanner(System.in); char player = 'x'; TicTacToe game = new TicTacToe(); boolean done = false; int Count=0; do{ System.out.print(game.toString()); System.out.print( "Row for " + player ); int row = in.nextInt(); System.out.print("Column for " + player + ": "); int column = in.nextInt(); game.set(row, column, player); if (player==('X')) player = 'O'; else player = 'X'; }while(!game.winner()&&Count<=9); } }thanks for all your help/** A 3 x 3 tic-tac-toe board. */ public class TicTacToe { /** Constructs an empty board. */ public TicTacToe() { board = new char [ROWS][COLUMNS]; // Fill with spaces for (int i = 0; i < ROWS; i++) for (int j = 0; j < COLUMNS; j++) board[i][j] =' '; } /** Sets a field in the board. The field must be unoccupied. @param i the row index @param j the column index @param player the player ("x" or "o") */ public void set(int i, int j, char player) { if (board[i][j]== ' ') board[i][j] = player; } /** Creates a string representation of the board, such as |x o| | x | | o| @return the string representation */ public String toString() { String r = ""; r+=" | | \n"; r+=" "+board[0][0]+" |"+board[0][1]+" | "+board[0][2]+"\n"; r+=" | | \n"; r+="----------\n"; r+=" | | \n"; r+=" "+board[1][0]+" |"+board[1][1]+" | "+board[1][2]+"\n"; r+=" | | \n"; r+="----------\n"; r+=" | | \n"; r+=" "+board[2][0]+" |"+board[2][1]+" | "+board[2][2]+"\n"; r+=" | | \n"; return r; } public boolean winner() { boolean winner; if(board[0][0] == board[0][1] && board[0][1] == board[0][2]&&board[0][0] !=' ') return true; if(board[1][0] == board[1][1] && board[1][1] == board[1][2]&&board[1][0] !=' ') return true; if(board[2][0] == board[2][1] && board[2][1] == board[2][2]&&board[2][0] !=' ') return true; if(board[0][0] == board[1][0] && board[1][0] == board[2][0]&&board[0][0] !=' ') return true; if(board[0][1] == board[1][1] && board[1][1] == board[2][1]&&board[0][0] !=' ') return true; if(board[0][2] == board[1][2] && board[1][2] == board[2][2]&&board[0][0] !=' ') return true; if(board[0][0] == board[1][2] && board[1][2] == board[2][2]&&board[0][0] !=' ') return true; if(board[2][0] == board[1][2] && board[1][2] == board[2][1]&&board[0][0] !=' ') return true; return false; } private char[][] board; private static final int ROWS = 3; private static final int COLUMNS = 3; }