title: Why am i not able to regenerate a new game board after user respond yes to if the want to restart?
body: <pre><code>https://cse.sc.edu/~shephejj/csce146/Homework/Homework01.html
  
  import java.util.*;
  public class MineSweep {
      enum  Spaces{Empty,Player,Cone,Mine}
      public static final int Board_Size=10;
      public final static double Percent_Mine = 0.1;
  
      public static void main(String[]arg){
          Spaces[][] Board= new Spaces[Board_Size][Board_Size];//Creates new multidimensional array.
          int numOfMoves=0;
          int positionX=0;
          int positionY=0;
          boolean isOver=false;
          boolean isDead = false;
          Random r= new Random();
          //Random Places the cone on the GameBoard.
          int coneX=r.nextInt(Board_Size);
          int coneY=r.nextInt(Board_Size);
          Scanner Scan = new Scanner(System.in);
          Scanner scan2 = new Scanner(System.in);
  
          for(int i=0;i&lt;Board.length;i++){
              for(int j =0; j&lt;Board[1].length;j++){
                  Board[i][j]=Spaces.Empty;
                      }
                  }
          Board[positionX][positionY]= Spaces.Player;
          Board[coneX][coneY]=Spaces.Cone;
          System.out.println("Welcoem to Mine Walker. Get the ice cream cone and avoid the Mines.");
  
          int mines = (int)(Board_Size*Board_Size*Percent_Mine);
          do
          {
              int x = r.nextInt(Board_Size-1)+1;
              int y =r.nextInt(Board_Size-1)+1;
              //Places mines in random spots
              if (Board[x][y]== Spaces.Empty)
              {
              Board[x][y]=Spaces.Mine;
              mines--;
              }
          }
          while(mines&gt;0);
          if(isDead==true){
          Board=generateBoard();
          }else{
  
              while(isOver==false)
                  {
                  for(int y=0;y&lt;Board.length;y++)
                  {
                      for(int x=0;x&lt;Board[y].length;x++)
                      {
                          switch(Board[x][y])
                          {
                              case Empty:
                                  System.out.print("_");
                                  break;
                              case Player:
                                  System.out.print("X");
                                  break;
                              case Mine:
                                  System.out.print("!");
                                  break;
                              case Cone:
                                  System.out.print("^");
                                  break;
                              default:
                                  System.out.print("?");
                              break;
                          }
                      }
                      System.out.println(" ");
                  }
                  System.out.println("Enter either -1,0,1 to move in the X or 9 to quit");
  
                  int directionX = Scan.nextInt();
  
                  if(directionX==9)
                  {
                      System.out.println("Game Over");
                      System.exit(0);
  
                      }
                  System.out.println("Enter either -1,0,1 to move in th Y");
                  int directionY= Scan.nextInt();
  
                  if(directionX&lt;-1 || directionX&gt;1){
                      System.out.println("Invalid Input X");
                      directionX=0;
                  }
                  if(directionY &lt;-1 || directionY&gt;1)
                  {
                      System.out.println("Invalid input Y");
                      directionY = 0;
                  }
  
                  Board[positionX][positionY] = Spaces.Empty;
                  positionX+=directionX;
                  positionY+=directionY;
  
                  if(positionX &lt; 0)
                  {
                      positionX = 0;
                  }
                  else if(positionX&gt;Board_Size-1)
                  {
                      positionX = Board_Size-1;
                  }
                  if(positionY &lt; 0)
                  {
                      positionY = 0;
                  }
                  else if(positionY&gt; Board_Size-1)
                  {
                      positionY = Board_Size-1;
                  }
                  String retry;
                  if(Board[positionX][positionY]==Spaces.Mine)
                  {           
                      isDead=true;
                      System.out.println("Boom! Dead!");
                      System.out.println("Would you like to play again? \"Yes\" or \"No\"");  
                      retry = scan2.nextLine();
                      if (retry.equalsIgnoreCase("Yes"))
                      {
  
                              isOver = false;  
                              generateBoard();
                      }
                      else if (retry.equalsIgnoreCase("No"))
                      {
                          System.out.println("Goodbye!");
                          System.exit(0); 
                      }
                  }
                  if(Board[positionX][positionY]==Spaces.Cone)
                  {
                      System.out.println("You win!");
                      System.out.println("Would you like to play again? \"Yes\" or \"No\"");
                  }
                  Board[positionX][positionY] = Spaces.Player;  
              }
          }
      }
  
  
      public static Spaces[][] generateBoard(){
          int positionX=0;
          int positionY=0;
          Random r= new Random();
          //Random Places the cone on the GameBoard.
          int coneX=r.nextInt(Board_Size);
          int coneY=r.nextInt(Board_Size);
          Spaces[][] Board= new Spaces[Board_Size][Board_Size];
       for(int i=0;i&lt;Board.length;i++){
              for(int j =0; j&lt;Board[1].length;j++){
                  Board[i][j]=Spaces.Empty;
                      }
                  }
          Board[positionX][positionY]= Spaces.Player;
          Board[coneX][coneY]=Spaces.Cone;
          System.out.println("Welcoem to Mine Walker. Get the ice cream cone and avoid the Mines.");
  
          int mines = (int)(Board_Size*Board_Size*Percent_Mine);
          do
          {
              int x = r.nextInt(Board_Size-1)+1;
              int y =r.nextInt(Board_Size-1)+1;
              //Places mines in random spots
              if (Board[x][y]== Spaces.Empty)
              {
              Board[x][y]=Spaces.Mine;
              mines--;
              }
          }
          while(mines&gt;0);
          return Board;
      }
  }
  </code></pre>
  
  <p>In the code is above.Everything works, i'm just unable to create a new game board.I create a method called "generateboard()" and I call that method if "isDead= true" and user responds yes to if they want to retry.Please Help !</p>