private void endGame() {
   System.out.println("Game Over!");
   if (gameState.isPlayerWinner()) {
     System.out.println("Player Wins");
     gui.setOut("Game Over! You Win!");
   } else {
     System.out.println("Computer Wins");
     gui.setOut("Game Over! Agent Wins!");
   }
 }
 private void loadingGame() {
   gameState.changeTurn();
   gameState.addAgentShips(smith.placeShips());
   gui.setOut(gameState.turnToString());
 }
  public static void main(String args[]) {

    GUI gui = new GUI(new GameState());
    Agent smith = new Agent();

    System.out.println("PlayerTurn " + gui.data.gameState.isPlayerTurn());
    System.out.println("Deployed " + gui.data.gameState.isBothPlayerAndAgentShipsDeployed());

    System.out.println("PlayerTurn " + gui.data.gameState.isPlayerTurn());
    System.out.println("Deployed " + gui.data.gameState.isBothPlayerAndAgentShipsDeployed());

    while (!gui.data.gameState.playerHomeGrid.allShipsPlaced()) {
      // PlayerDeploymentPhase, wait for player to place all their ships
    }

    gui.data.gameState.addAgentShips(smith.placeShips());

    gui.data.gameState.setPlayerTurn();
    gui.data.outText.setText(gui.data.gameState.turnToString());

    while (!gui.getGameOver()) {

      while (gui.data.gameState.isPlayerTurn() && !gui.getGameOver()) {
        gui.data.gameState.setShipSunkStates();
        if (gui.data.gameState.areAllAgentShipsSunk()) {
          System.out.println("All sunk");
          gui.data.gameState.SetGameOver();
          gui.data.gameState.PlayerIsTheWinner();
        }
      }
      gui.repaint();

      while (gui.data.gameState.isAgentTurn() && !gui.data.gameState.IsGameOver()) {

        System.out.println("agent turn");
        smith.nextShot(gui.data.gameState.influenceMap, gui.data.gameState.compAtt);
        gui.agentShot(smith.getI(), smith.getJ());
        System.out.println("shot at " + smith.getI() + " " + smith.getJ());
        System.out.println(gui.data.gameState.compAtt.toString());
        // if(gameState.playerHome.get(i,j

        determineIfShotSunkAShip(gui, smith);

        gui.data.gameState.setShipSunkStates();

        try {
          Thread.sleep(1000);
        } catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

        /*
        if(g.getAgentShipsSunk())
        {
        	g.setGameOver();
        	g.setPlayerWins();
        }
        */
        if (gui.data.gameState.getPlayerShipsSunk()) {
          gui.setAgentWins();
          gui.data.gameState.SetGameOver();
          gui.data.gameState.setPlayerTurn();
        }
      }
    }

    System.out.println("Game Over!");
    if (gui.data.gameState.isPlayerWinner()) {
      System.out.println("Player Wins");
      gui.setOut("Game Over! You Win!");
    } else {
      System.out.println("Computer Wins");
      gui.setOut("Game Over! Agent Wins!");
    }
  }