Browse Source

Update Implementation Methode AIGridGUI

main
Thoumi Ngonga Brice 2 years ago
parent
commit
6a8f0f3c1d
  1. 29
      src/main/java/BattleShip/AIGridGUI.java
  2. BIN
      target/classes/BattleShip/AIGridGUI.class

29
src/main/java/BattleShip/AIGridGUI.java

@ -156,4 +156,33 @@ public class AIGridGUI extends JPanel {
return endGame;
}
public void go() {
//Play a turn by making a guess at a cell.
int guessLocation = 0;
boolean gameOver = true;
numOfGuesses++;
BSButton b = null;
Ship s = null;
boolean killed = false;
boolean isClear = false;
if(randomGuess) {
//Find out the maximum ship length of the surviving ships.
int minClearSpace = 0;
for(Ship sh : allShips) {
if(!sh.isKilled() && sh.getLength() > minClearSpace) {
minClearSpace = sh.getLength();
}
}
//Create an array of all possible cells and shuffle the order of the cells. Potential guesses are drawn from this array.
int[] guesses = new int[(rows * columns)];
for(int i = 0; i < rows * columns; i++) {
guesses[i] = i;
}
}
}
}

BIN
target/classes/BattleShip/AIGridGUI.class

Loading…
Cancel
Save