@FXMLpublicLabeloccupiedSpace;// This label will display all current user occupied space, as an alternative to the grid display.
@FXMLpublicLabelenemyHM;//This label will display users last move as a hit or miss.
@FXMLprivateButtonplace;
@FXMLprivateButtonfire;
@FXMLprivateButtonbattleStage;
@FXMLprivateButtonquit;
@FXMLpublicLabellostShips;// This label will inform the user of all ships sunk by the computer. As an alternative to the grid display.
@FXMLpublicLabeltakenShips;// This label will inform the user of all ships they have sunk. As an alternative to the grid display.
@FXMLpublicLabelhits;// This label will inform the user of all the places they have had a hit on the computer grid, As an alternative to the grid display.
@FXMLpublicLabelstage;
@FXMLpublicLabeladmiral;
@FXMLpublicLabelstatus;
ArrayList<String>hitsList=newArrayList<String>();//Holds the data for the corresponding label above.
ArrayList<String>lostShipsList=newArrayList<String>();//Holds the data for the corresponding label above.
ArrayList<String>takenShipsList=newArrayList<String>();//Holds the data for the corresponding label above.
@FXMLprivateButtonplace;//Runs the code, in relation to placing a ship.
@FXMLprivateButtonfire;//Runs the code in relation to firing on the computer grid.
@FXMLprivateButtonbattleStage;//Runs the code which furthers the game from the placing stage to the battle stage.
@FXMLprivateButtonquit;//Ends the game.
@FXMLpublicLabelstage;//This label will inform the user of which stage of the game they are in
@FXMLpublicLabeladmiral;//This label will display: hits, misses, rejections, and general information for the user.
@FXMLpublicLabelstatus;//This label will display the number of occupied spaces left on player grid and computer grid.
enemyHM.setText("Computer: I have hit "+response+CmptrMove);
if(response!="Hit "){
lostShipsList.add(response);
lostShips.setText("You have lost:"+lostShipsList.toString());
}
}
}// if (computer fire) END
elseif(!computerB.fire(playerS,CmptrMove)){
enemyHM.setText("Computer: I have missed at "+CmptrMove);
}
status.setText("Computer status: "+computerS.allMoves.size()+" Player Status: "+playerS.allMoves.size());
status.setText("Ships left: "+computerS.allMoves.size()+" Player Status: "+playerS.allMoves.size());// Number left of both players ships updated and displayed.
}
elseif(stage0){
admiral.setText("Place all ships before firing");
admiral.setText("Place all ships before firing");//Placement stage not completed.