Browse Source

Merge remote-tracking branch 'origin/main'

main
fdai4581 2 years ago
parent
commit
0dc136654a
  1. 10
      src/main/java/BattleShip/BShip.java
  2. 4
      src/test_/java/AIGridGUITest.java
  3. BIN
      target/classes/BattleShip/BShip$NewGameListener.class
  4. BIN
      target/classes/BattleShip/BShip.class

10
src/main/java/BattleShip/BShip.java

@ -39,7 +39,15 @@ public class BShip {
grid2.placeShips(); 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() { public void buildGUI() {

4
src/test_/java/AIGridGUITest.java

@ -39,6 +39,10 @@ public class AIGridGUITest {
@Test @Test
public void testPlaceShips() { 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);
} }
} }

BIN
target/classes/BattleShip/BShip$NewGameListener.class

BIN
target/classes/BattleShip/BShip.class

Loading…
Cancel
Save