diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index ea4014d..dbefd40 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/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; + } + } + } } diff --git a/target/classes/BattleShip/AIGridGUI.class b/target/classes/BattleShip/AIGridGUI.class index e603c49..9814b98 100644 Binary files a/target/classes/BattleShip/AIGridGUI.class and b/target/classes/BattleShip/AIGridGUI.class differ