Skip to content
Snippets Groups Projects
Commit 365c2cd0 authored by jali6's avatar jali6
Browse files

the bug was fixed and the unit tests were passed

parent 21f85fa4
No related branches found
No related tags found
No related merge requests found
......@@ -112,8 +112,13 @@ 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(0, 0) && getHorizontal(0, 1) && getVertical(0, 0) && getVertical(1, 0)) {
return true;
}
else
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) {
......@@ -140,6 +145,7 @@ public class DotsAndBoxesGrid {
}
// FIXME: You need to throw an exception if the line was already drawn.
if (getHorizontal(x, y)) throw new IllegalStateException();
this.horizontals[x][y] = true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment