Battleships
class Main {
public static void main(String[] args) {
// Create a battleshipCore instance
BattleshipCore core = new BattleshipCore();
// make a int array for location of battleship
// [2,3,4]
int[] locations = {2, 3, 4};
// set cellLocations into battleshipCore
core.setLocationCells(locations);
// make a fake user guess
// "4"
String userGuess = "4";
// call checkYourself with fake guess
String result = core.checkYourself(userGuess);
// if return "hit"
if (result.equals("hit")) {
System.out.println("success");
} else {
System.out.println("failed");
}
}
}INFO