BattleShipGame Code Explanation
BattleShipGame Code Explanation
/**
* The author of this code is 'yeabs'.
*/
This line starts the BattleShipGame class. All of the code for the game will be inside this
class.
BattleShipGame(){
this.initGrid();
}
This is a constructor that calls initGrid to set up the grid when a new game is created.
BattleShipGame(int numOfShip){
this.numOfShip = numOfShip;
this.initGrid();
}
This is another constructor allowing the number of ships to be customized.