Every move I make is invalid, help.
i.e.
Enter a row (0, 1, or 2) for player X: 0
Enter a Column (0, 1, or 2) for player X: 0
Invalid move
Enter a row (0, 1, or 2) for player X: 0
Enter a Column (0, 1, or 2) for player X: 1
Invalid move
import java.util.Scanner; public class Week_Three { private static final char EMPTY = ' '; public static void main(String[] args){ char[][] board = new char[3][3]; printBoard(board); do { // User one X player play('X', board); printBoard(board); //Display result if X player win or Draw Game if (Winner(board)) { System.out.println("X Player Won"); System.exit(1); } else if (drawGame(board)) { System.out.println("Draw"); System.exit(2); } // User Two O player play('O', board); printBoard(board); //Display result if O player win or Draw Game if (Winner(board)) { System.out.println("O Player Won"); System.exit(3); } else if (drawGame(board)) { System.out.println("Draw"); System.exit(4); } } while (true); } //get user input for moves public static void play(char player, char[][] board) { Scanner input = new Scanner(System.in); boolean validInput = false; do { System.out.print("Enter a row (0, 1, or 2) for player " + (player) +": "); int row = input.nextInt(); System.out.print("Enter a Column (0, 1, or 2) for player " + (player) +": "); int column = input.nextInt(); if (gamePiece(board, row, column, player)) { validInput = true; } else System.out.println("Invalid move"); } while (!validInput); } static boolean gamePiece(char[][] board, int row, int column, char player) { for (int i = 0; i < board.length; i++) { if (board[i][row] == EMPTY) { board[i][row] = player; return true; } } for (int j = 0; j < board.length; j++) { if (board[column][j] == EMPTY) { board[column][j] = player; return true; } } return false; } //display game board static void printBoard(char[][] board) { System.out.println("-------------"); for (int i = board.length - 1; i >= 0; i--) { System.out.print("| "); for (int j = 0; j < board[i].length; j++) System.out.print(board[i][j] != EMPTY ? board[i][j] + " | ": "|"); System.out.println(); System.out.println("-------------"); } } //Display win public static boolean Winner(char[][] board) { return winningGame(board); } //Test Winner-Win if hit 3 consecutive pieces public static boolean winningGame(char[][] board) { boolean winning; if(board[0][0]==board[0][1] && board[0][1]==board[0][2]) winning = true; else if(board[1][0]==board[1][1] && board[1][1]==board[1][2]) winning = true; else if(board[2][0]==board[2][1] && board[2][1]==board[2][2]) winning = true; else if(board[0][0]==board[1][0] && board[1][0]==board[2][0]) winning = true; else if(board[0][1]==board[1][1] && board[1][1]==board[2][1]) winning = true; else if(board[0][2]==board[1][2] && board[1][2]==board[2][2]) winning = true; else if(board[0][0]==board[1][1] && board[1][1]==board[2][2]) winning = true; else if(board[0][2]==board[1][1] && board[1][1]==board[2][0]) winning = true; else winning = false; return winning; } //draw game conditions public static boolean drawGame(char[][] board) { for (int i = 0; i < board.length; i++) { for (int j = 0; j < board[i].length; j++) { if (board[i][j] == EMPTY) { return false; } } } return true; } }