From 488ea3604aafff6033da5dfd8470e8b0d8d59462 Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Wed, 8 Feb 2023 21:13:05 +0100 Subject: [PATCH 1/2] update bship class --- src/main/java/BattleShip/BShip.java | 10 +++++++++- .../BattleShip/BShip$NewGameListener.class | Bin 1448 -> 1448 bytes target/classes/BattleShip/BShip.class | Bin 3393 -> 3685 bytes target/classes/PingPong/GamePanel$AL.class | Bin 731 -> 731 bytes target/classes/PingPong/GamePanel.class | Bin 2818 -> 4784 bytes 5 files changed, 9 insertions(+), 1 deletion(-) 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/target/classes/BattleShip/BShip$NewGameListener.class b/target/classes/BattleShip/BShip$NewGameListener.class index 30306bad3527117da4e09f298abf8bd9f6003bad..7fda8956199c3bb140ba8c14def1548b0bda832c 100644 GIT binary patch delta 92 zcmZ3%y@GoKI}2mVW)2oEM$dExL52(lC5B7}Eru)xBZh1SD~5aqFNOk!V1`157={vt v9EMULEMur+sATA4sA8DTP|dJ_p@Cr?LnFgZhGvF?3~dZ27}_UCv-$!6fO-{c delta 92 zcmZ3%y@GoKI}2mXW)2oEM$dQ#L52hdC5A)>EruipBZg!KD~5CiFNO?;V1`VF7=|1m t%w;HL$YZEuC}ikkC}Nn-P|UD^p@Lx@LnXsbhH8d`K$#N^^^>DneF0^H6w3er diff --git a/target/classes/BattleShip/BShip.class b/target/classes/BattleShip/BShip.class index c90ea358e2552839303bc77f940bcf0c80f3a19e..a918404646313e397d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@Su_FIO^6?c*#bufJD&%AA+0wL4I(+_Ym&3aY!8Ck!{$*PO@=CSV_udf8{!U zv(Ya?n(NK;3fPEoKoVDA7>QvFJ*uUcLF-ir;u_SWnjXKIbiK3a4?mms&7t?C20L&q z4v^oA>(GzuNd!TBj=A_2wfGq~;8)y;KdAZ)Ze}@{&&FW^^WheDB^I*TXka(dJ8htm zne-@kUe|Kd3Wz;k zJz;uVVo_5MM~&fT|Mlxs%*H($HbCcod!3_SLkI@nZf{I&W{{eaO)5ON&WSAya{Z!Y z{URp@h1rm-Z%`0rD4Kb8Te}e*@#(`VB9Ii^$B_TOv=ea#`=;=qp<+l-Z)I?H7>V*# zdc;tWWGMIPrpfE&GG_wY#0Bo>QK>`~oov_eAX2q2RxomEnjHjfZ1V6-Tf_yv6Gp-oP>P zct^v#IK@q+u5wJn`}lw%k6Q7?Mxr5-R1wEz&nv?j4HgdaNyXp?oO|gdzUCJtH{myY znY6HpLGwpx09pq1c-)}ct4Mz#e;^z;4NB0vWhKk17wR?TqPzpPzu*%rotL?639=kSKU#ent_*@ffsQopvd||?`uQwu>>>0@8F+#P zo6;EQ60SY#hA+Ev*1b24)Ie7Tkzg9JKn6p>g5fmG_H1&5_I7wONCd0X7`5;~HvbUi zm)fPpawF3pd{t9Kl5$BTX;{n)Ys`NFSr{E=$*VM zL<8od5p`Hhe@r(bfF+8obwpC8Rj#HF)Wxom&pzQcz*}# delta 27 icmcc3dYg5FH4|g-WE-Xk&M*dUhHwTkhKR{?nd|^-j|R#B diff --git a/target/classes/PingPong/GamePanel.class b/target/classes/PingPong/GamePanel.class index b5a0ce9db11d0429828a4d21b9b4e7f9e3a1ab51..194c31a4f0b45fd146373c440d732d6385dd9d71 100644 GIT binary patch literal 4784 zcmb_gd0br875?rFFk$in3_&D`8Z~NIk`UYp8X-WENrnW05}|7Hn0aAFh8diBkYH_% zwM*2x*CkrFR!!~d0z+zAt9G;2XtlMAw%T30*u`o$Ths5n_vXDx%&&hHesAu*=bd|& z?=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%L>X|65?kD0W@3o)G-hOke_cIEGG2IUhEu*6ZLy3>Sve z&a7kyEjCB)fozuC1LxC-Tba~0cB!|dGnUsG3y<&YxX@$y-&o?^ lC@%euIWo2=+1fC3eoW4XCwNK>@U{xic#=OuRs8%6@g8~!;Pn6i From 5b0df93808adcd1fa7649d1217ec859ef473ce2f Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Wed, 8 Feb 2023 21:17:35 +0100 Subject: [PATCH 2/2] Uni Test AIGridGUITest (update) --- src/test_/java/AIGridGUITest.java | 4 ++++ 1 file changed, 4 insertions(+) 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); } }