Browse Source

Update Implementation Methode AIGridGUI

main
Thoumi Ngonga Brice 2 years ago
parent
commit
4c5bbea894
  1. 7
      src/main/java/BattleShip/AIGridGUI.java

7
src/main/java/BattleShip/AIGridGUI.java

@ -183,6 +183,13 @@ public class AIGridGUI extends JPanel {
for(int i = 0; i < rows * columns; i++) { for(int i = 0; i < rows * columns; i++) {
guesses[i] = i; guesses[i] = i;
} }
Random rand = new Random();
for(int i = 0; i < guesses.length; i++) {
int randInt = rand.nextInt(guesses.length);
int randGuess = guesses[randInt];
guesses[randInt] = guesses[i];
guesses[i] = randGuess;
}
} }
} }
} }
Loading…
Cancel
Save