diff --git a/src/main/java/BattleShip/BShip.java b/src/main/java/BattleShip/BShip.java index b7fe9dd..032d572 100644 --- a/src/main/java/BattleShip/BShip.java +++ b/src/main/java/BattleShip/BShip.java @@ -39,7 +39,15 @@ public class BShip { grid2.placeShips(); } - //.. + //Start threads to check if ships have been placed and if guesses have been made. + + Runnable reader = new IncomingGuessReader(); + Thread readerThread = new Thread(reader); + readerThread.start(); + + Runnable spReader = new ShipsPlacedReader(); + Thread spReaderThread = new Thread(spReader); + spReaderThread.start(); } public void buildGUI() { diff --git a/src/test_/java/AIGridGUITest.java b/src/test_/java/AIGridGUITest.java index aaa49e2..9325f89 100644 --- a/src/test_/java/AIGridGUITest.java +++ b/src/test_/java/AIGridGUITest.java @@ -39,6 +39,10 @@ public class AIGridGUITest { @Test public void testPlaceShips() { + AIGridGUI aiGridGUI = new AIGridGUI(10, 10); + aiGridGUI.placeShips(); + assertEquals(100, aiGridGUI.listeners.size()); + assertEquals("Place destroyer. Right click to toggle horizontal/vertical.", aiGridGUI.text); } } diff --git a/target/classes/BattleShip/BShip$NewGameListener.class b/target/classes/BattleShip/BShip$NewGameListener.class index 30306ba..7fda895 100644 Binary files a/target/classes/BattleShip/BShip$NewGameListener.class and b/target/classes/BattleShip/BShip$NewGameListener.class differ diff --git a/target/classes/BattleShip/BShip.class b/target/classes/BattleShip/BShip.class index c90ea35..a918404 100644 Binary files a/target/classes/BattleShip/BShip.class and b/target/classes/BattleShip/BShip.class differ