From 7001d7fb1d77934c7250ec8fdfa760512c2acf05 Mon Sep 17 00:00:00 2001 From: Thoumi Ngonga Brice Date: Tue, 7 Feb 2023 00:05:04 +0100 Subject: [PATCH] Update Implementation AIGridGUI class --- src/main/java/BattleShip/AIGridGUI.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/BattleShip/AIGridGUI.java b/src/main/java/BattleShip/AIGridGUI.java index 4108b81..59ffb6a 100644 --- a/src/main/java/BattleShip/AIGridGUI.java +++ b/src/main/java/BattleShip/AIGridGUI.java @@ -270,6 +270,15 @@ public class AIGridGUI extends JPanel { } right.setCell(r); right.setCount(rightCount); + + int l = f; + int leftCount = -1; + while(l >= 0 && cellsHit[l] && !cellsKilled[l]) { + l = moveLeft(l); + leftCount++; + } + left.setCell(l); + left.setCount(leftCount); } }