|
|
@ -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. |
|
|
|