From 06f529a6bb3a28eddfa9fffdfe23e56b7e0872cf Mon Sep 17 00:00:00 2001 From: Steve Smith <ssmit235@myune.edu.au> Date: Fri, 30 Jul 2021 12:32:16 +0800 Subject: [PATCH] Fixed isBoxComplete method. --- src/main/java/dotsandboxes/DotsAndBoxesGrid.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java index 4c22cf8..8f323c3 100644 --- a/src/main/java/dotsandboxes/DotsAndBoxesGrid.java +++ b/src/main/java/dotsandboxes/DotsAndBoxesGrid.java @@ -112,8 +112,8 @@ 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; + boolean isBoxComplete = getHorizontal(x, y) && getVertical(x, y) && getVertical(x+1, y) && getHorizontal(x, y+1); + return isBoxComplete; } /** Tries to claim a box for a player. If the box is complete, sets the ownership and returns true. */ -- GitLab