title: Repeating players turn if spot is already taken in tic tac toe game
body: <p>I have to create a program of tick tac toe for an assignment I am doing.</p>
  
  <p>I have run into an issue where the program will skip the players turn if the spot in the array has already been chosen. </p>
  
  <p>I was wondering if anyone would know how to help me fix this...</p>
  
  <p>for example: I enter in the array[1][1] and the second player chooses that position as well. The program will not update the board and continue on to the next player therefore skipping their turn.</p>
  
  <p>I will paste my code below and if anyone has any questions don't hesitate to ask.</p>
  
  <pre><code>public class TicTacToe {
  
  public static char[][] board = new char[3][3];
  static Scanner scan = new Scanner(System.in);
  public static String keepPlaying;
  public static char yesOrNo;
  public static boolean playing;
  public static int row, col;
  public static User human1 = new User();
  public static User human2 = new User();
  
  public static void main(String[] args) {
  
      human1.getUser1Name();
      human2.getUser2Name();
  
      System.out.println("\nPlayer 1: " + human1.human1Name() + ": X's");
      System.out.println("Player 2: " + human2.human2Name() + ": O's\n");
  
      initializeBoard();
      displayBoard();
  
      playing = true;
  
  
      while (playing == true)
      {
  
          System.out.println("\n" + human1.human1Name() + " it's your turn.");
          human1.getChoice();
          human1.convert();
  
  
          if (human1.returnRow() == 0 &amp;&amp; human1.returnCol() == 0/* &amp;&amp; board[0][0] == ' '*/)
          {
              board[0][0] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 0 &amp;&amp; human1.returnCol() == 1 &amp;&amp; board[1][0] == ' ')
          {
              board[1][0] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 0 &amp;&amp; human1.returnCol() == 2 &amp;&amp; board[2][0] == ' ')
          {
              board[2][0] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 1 &amp;&amp; human1.returnCol() == 0 &amp;&amp; board[0][1] == ' ')
          {
              board[0][1] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 1 &amp;&amp; human1.returnCol() == 1 &amp;&amp; board[1][1] == ' ')
          {
              board[1][1] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 1 &amp;&amp; human1.returnCol() == 2 &amp;&amp; board[2][1] == ' ')
          {
              board[2][1] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 2 &amp;&amp; human1.returnCol() == 0 &amp;&amp; board[0][2] == ' ')
          {
              board[0][2] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 2 &amp;&amp; human1.returnCol() == 1 &amp;&amp; board[1][2] == ' ')
          {
              board[1][2] = 'X';
              displayBoard();
          }
          else if (human1.returnRow() == 2 &amp;&amp; human1.returnCol() == 2 &amp;&amp; board[2][2] == ' ')
          {
              board[2][2] = 'X';
              displayBoard();
          }
  
          if (checkForWinner() == true)
          {
              System.out.println("\n" + human1.human1Name() + " has won the game!!!");
              playAgain();
              if (playing == false)
              {
                  break;
              }
  
          }
  
          if (board[0][0] != ' ' &amp;&amp; board[0][1] != ' ' &amp;&amp; board[0][2] != ' ' &amp;&amp; board[1][0] != ' ' &amp;&amp; board[1][1] != ' '
                  &amp;&amp; board[1][2] != ' ' &amp;&amp; board[2][0] != ' ' &amp;&amp; board[2][1] != ' ' &amp;&amp; board[2][2] != ' ')
          {
              System.out.println("It's a draw!!!");
              playAgain();
              if (playing == false)
              {
                  break;
              }
          }
  
  
  
          System.out.println("\n" + human2.human2Name() + " it's your turn.");
          human2.getChoice();
          human2.convert();
  
          if (human2.returnRow() == 0 &amp;&amp; human2.returnCol() == 0 /*&amp;&amp; board[0][0] == ' '*/)
          {
              board[0][0] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 0 &amp;&amp; human2.returnCol() == 1 &amp;&amp; board[1][0] == ' ')
          {
              board[1][0] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 0 &amp;&amp; human2.returnCol() == 2 &amp;&amp; board[2][0] == ' ')
          {
              board[2][0] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 1 &amp;&amp; human2.returnCol() == 0 &amp;&amp; board[0][1] == ' ')
          {
              board[0][1] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 1 &amp;&amp; human2.returnCol() == 1 &amp;&amp; board[1][1] == ' ')
          {
              board[1][1] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 1 &amp;&amp; human2.returnCol() == 2 &amp;&amp; board[2][1] == ' ')
          {
              board[2][1] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 2 &amp;&amp; human2.returnCol() == 0 &amp;&amp; board[0][2] == ' ')
          {
              board[0][2] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 2 &amp;&amp; human2.returnCol() == 1 &amp;&amp; board[1][2] == ' ')
          {
              board[1][2] = 'O';
              displayBoard();
          }
          else if (human2.returnRow() == 2 &amp;&amp; human2.returnCol() == 2 &amp;&amp; board[2][2] == ' ')
          {
              board[2][2] = 'O';
              displayBoard();
          }
  
  
          if (checkForWinner() == true)
          {
              System.out.println("\n" + human2.human2Name() + " has won the game!!!");
              playAgain();
          }
  
          if (board[0][0] != ' ' &amp;&amp; board[0][1] != ' ' &amp;&amp; board[0][2] != ' ' &amp;&amp; board[1][0] != ' ' &amp;&amp; board[1][1] != ' '
                  &amp;&amp; board[1][2] != ' ' &amp;&amp; board[2][0] != ' ' &amp;&amp; board[2][1] != ' ' &amp;&amp; board[2][2] != ' ')
          {
              System.out.println("It's a draw!!!");
              playAgain();
          }
  
  
      }
  
  
  }
  
  public TicTacToe() {
  
      board = new char[3][3];
  
  }
  
  public static void initializeBoard() {
  
      for (int row = 0; row &lt; 3; row++)
          {
              for (int col = 0; col &lt; 3; col++)
              {
                  board[row][col] = ' ';
              }
          }
      }
  
  public static void displayBoard() {
  
      System.out.println("    A   B   C");
      System.out.println("  -------------");
  
      for (int row = 0; row &lt; 3; row++)
      {
          System.out.print((row + 1) + " | ");
          for (int col = 0; col &lt; 3; col++)
          {
              System.out.print(board[row][col] + " | ");
          }
          System.out.println();
          System.out.println("  -------------");
      }
  }
  
  public static boolean checkForWinner() {
  
      if (board[0][0] == board[0][1] &amp;&amp; board[0][1] == board[0][2] &amp;&amp; board[0][1] != ' ')
      {
          return true;
      }
      if (board[1][0] == board[1][1] &amp;&amp; board[1][1] == board[1][2] &amp;&amp; board[1][1] != ' ')
      {
          return true;
      }
      if (board[2][0] == board[2][1] &amp;&amp; board[2][1] == board[2][2] &amp;&amp; board[2][1] != ' ')
      {
          return true;
      }
      if (board[0][0] == board[1][0] &amp;&amp; board[1][0] == board[2][0] &amp;&amp; board[1][0] != ' ')
      {
          return true;
      }
      if (board[0][1] == board[1][1] &amp;&amp; board[1][1] == board[2][1] &amp;&amp; board[1][1] != ' ')
      {
          return true;
      }
      if (board[0][2] == board[1][2] &amp;&amp; board[1][2] == board[2][2] &amp;&amp; board[1][2] != ' ')
      {
          return true;
      }
      if (board[0][0] == board[1][1] &amp;&amp; board [1][1] == board[2][2] &amp;&amp; board[1][1] != ' ')
      {
          return true;
      }
      if (board[0][2] == board [1][1] &amp;&amp; board[1][1] == board[2][0] &amp;&amp; board[1][1] != ' ')
      {
          return true;
      }
  
      return false;
  }
  
  public static boolean playAgain() {
  
      System.out.println("\nWould you like to play again?");
  
          keepPlaying = scan.nextLine();
  
          yesOrNo = keepPlaying.toUpperCase().charAt(0);
  
      if (yesOrNo == 'N')
      {
          System.out.println("\nThanks for playing!");
          playing = false;
          initializeBoard();
          return playing;
      }   
          else if (yesOrNo == 'Y')
          {   
              initializeBoard();
              displayBoard();
              return true;
          }
      return playing;
  }
  
  public static boolean notValid() {
  
      if (human1.returnRow() &gt; 2 || human1.returnRow() &lt; 0 || human1.returnCol() &gt; 2 || human1.returnCol() &lt; 0 || human2.returnRow() &gt; 2 
              || human2.returnRow() &lt; 0 || human2.returnCol() &gt; 2 || human2.returnCol() &lt; 0 || !isEmpty())
      {
          System.out.println("Invalid");
          return true;
      }
      else
      {
          return false;
      }
  }
  
  public static boolean isEmpty() {
  
      if (board[0][0] == ' ' &amp;&amp; board[0][1] == ' ' &amp;&amp; board[0][2] == ' ' &amp;&amp; board[1][0] == ' ' &amp;&amp; board[1][1] == ' '
                  &amp;&amp; board[1][2] == ' ' &amp;&amp; board[2][0] == ' ' &amp;&amp; board[2][1] == ' ' &amp;&amp; board[2][2] == ' ')
      {
          return true;
      }
      else
      {
          System.out.println("That position is taken.\n");
          return false;
      }
  }
  </code></pre>
  
  <p>}</p>