diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index 042c5ba..783cc30 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -349,6 +349,16 @@ public class AIGridGUI extends JPanel { if(!unkilledCells) { randomGuess = true; } + } else { + //If cell hit but not killed, mark cell appropriately. + text = "Other player got a hit. Your turn."; + b.setBackground(Color.red); + //If previously random guessing, switch to locking onto the hit cell. + if(randomGuess) { + f = b.getGridLocation(); + randomGuess = false; + } + cellsHit[guessLocation] = true; } } }