Browse Source

Update Implementation AIGridGUI class

main
Thoumi Ngonga Brice 2 years ago
parent
commit
a7ef8c818e
  1. 10
      src/main/java/BattleShip/AIGridGUI.java

10
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;
}
}
}

Loading…
Cancel
Save