Browse Source

Update Implementation AIGridGUI class

main
Thoumi Ngonga Brice 2 years ago
parent
commit
186ea8c1f2
  1. 13
      src/main/java/BattleShip/AIGridGUI.java

13
src/main/java/BattleShip/AIGridGUI.java

@ -361,6 +361,19 @@ public class AIGridGUI extends JPanel {
cellsHit[guessLocation] = true;
}
}
//Mark game as not over unless all ships killed.
for(Ship sh : allShips) {
if(!sh.isKilled()) {
gameOver = false;
}
}
//Game over message.
if(gameOver) {
text = "You Lost in " + numOfGuesses + " guesses.";
endGame = true;
}
}
//Return the location of a cell one space in the given direction, or return -1 if out of bounds.

Loading…
Cancel
Save