From a5d178c1215ab91689108b1c27aa55b91478971e Mon Sep 17 00:00:00 2001
From: Krishkumar Patel <kpatel9@myune.edu.au>
Date: Fri, 18 Aug 2023 01:39:02 +1000
Subject: [PATCH] Fixed the code in the boxComplete method, which was to check
 north and south horizontal lines and east and west vertical lines in-order to
 determine if the box is complete or not.

---
 src/main/java/dotsandboxes/DotsAndBoxesGrid.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
index 922fae9..feaac4b 100644
--- a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
+++ b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java
@@ -117,7 +117,10 @@ public class DotsAndBoxesGrid {
 
         // A box is complete if the north and south horizontals and the east and west verticals have all been drawn.
         // FIXME: You'll need to fix this code (after writing a test first).
-        return true;
+        if ((getHorizontal(x, y) && getHorizontal(x, y + 1)) && (getVertical(x, y) && getVertical(x + 1, y))) {
+            return true;
+        }
+        return false;
     }
 
     /** Tries to claim a box for a player. If the box is complete, sets the ownership and returns true. */
-- 
GitLab