Skip to content
Snippets Groups Projects
Commit a5d178c1 authored by Krishkumar Sandipkumar Patel's avatar Krishkumar Sandipkumar Patel
Browse files

Fixed the code in the boxComplete method, which was to check north and south...

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.
parent 222de015
Branches master
No related tags found
No related merge requests found
......@@ -117,8 +117,11 @@ 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).
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. */
private boolean claimBox(int x, int y, int p) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment