checks 3 cases are created checks;
+ * first case is TENT tile at x=0,
+ * second case is TENT tile at x=1,
+ * and a third case is TENT tile at x=2.
+ * The cases can be in any order.
+ * Then, it checks that other cells have not been modified
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void TentOrTreeTestOneTentClue() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/FillinRowCaseRule/EmptyRowOneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentClue testing_row = board.getClue(3, 1);
+ ArrayList checks 3 cases are created checks;
+ * first case is TENT tiles at x=0 and x=1,
+ * second case is TENT tiles at x=1 and x=2,
+ * and a third case is TENT tiles at x=0 and x=2.
+ * The cases can be in any order.
+ * Then, it checks that other cells have not been modified
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void TentOrTreeTestTwoTentClue() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/FillinRowCaseRule/EmptyRowTwoTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentClue testing_row = board.getClue(3, 1);
+ ArrayList checks 3 cases are created checks;
- * first case is TENT tiles at x=0 and x=1,
- * second case is TENT tiles at x=1 and x=2,
- * and a third case is TENT tiles at x=0 and x=2.
- * The cases can be in any order.
+ * checks 1 case is created. Checks that the case is when
+ * there are TENT tiles at x=0 and x=2.
* Then, it checks that other cells have not been modified
*
* @throws InvalidFileFormatException
@@ -113,17 +110,14 @@ public void TentOrTreeTestTwoTentClue() throws InvalidFileFormatException {
ArrayList checks 0 cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void TentOrTreeTestThreeTentClue() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/FillinRowCaseRule/EmptyRowThreeTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentClue testing_row = board.getClue(3, 1);
+ ArrayList checks that 1 case is created and that it is equivalent to FinishWithGrass rule
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void TentOrTreeTestZeroTentClue() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/FillinRowCaseRule/EmptyRowZeroTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentClue testing_row = board.getClue(3, 1);
+ ArrayList checks 0 cases are created
+ * checks that 0 cases are created
*
* @throws InvalidFileFormatException
*/
diff --git a/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRowZeroTent b/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRowZeroTent
new file mode 100644
index 000000000..6091c6476
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRowZeroTent
@@ -0,0 +1,25 @@
+ checks that 1 case is created and that it is equivalent to FinishWithGrass rule
*
@@ -155,12 +155,16 @@ public void TentOrTreeTestTwoTentClue() throws InvalidFileFormatException {
// assert correct number of cases created
Assert.assertEquals(1, cases.size());
+ // Only one arrangement is possible when taking into account the
+ // touching tents contradiction rule.
TreeTentBoard testCase = (TreeTentBoard) cases.getFirst();
+ // The two side tiles are tents,
Assert.assertEquals(TreeTentType.TENT, testCase.getCell(0, 1).getType());
Assert.assertEquals(TreeTentType.TENT, testCase.getCell(2, 1).getType());
+ // and the center tile is grass.
Assert.assertEquals(TreeTentType.GRASS, testCase.getCell(1, 1).getType());
// checks other cells have not been modified
@@ -201,7 +205,7 @@ public void TentOrTreeTestThreeTentClue() throws InvalidFileFormatException {
TreeTentClue testing_row = board.getClue(3, 1);
ArrayList checks that 1 case is created and that it is equivalent to FinishWithGrass rule
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentFourTreesTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTentCaseRule/FourTreesOneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList checks that 1 case is created and that it is equivalent to FinishWithGrass rule
+ * checks that 4 cases are created, each of which create a line
+ * connecting the tent to one of the four trees without repeat.
*
* @throws InvalidFileFormatException
*/
@@ -69,7 +70,7 @@ public void LinkTentFourTreesTest() throws InvalidFileFormatException {
// and cover all four possibilities
boolean exists = false;
for (TreeTentLine expectedLine : expectedLines) {
- if (line.compare(line)) {
+ if (line.compare(expectedLine)) {
expectedLines.remove(expectedLine);
exists = true;
break;
@@ -91,4 +92,100 @@ public void LinkTentFourTreesTest() throws InvalidFileFormatException {
}
}
}
+
+ /**
+ * empty 3x3 TreeTent puzzle Tests LinkTentCaseRule on a central tent
+ * with one tree surrounding it.
+ *
+ * checks that 1 cases is with the line connecting the central tent and the tree
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentOneTreeTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTentCaseRule/OneTreeOneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures no cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentNoTreesTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTentCaseRule/NoTrees", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures no cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentDiagTreesTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTentCaseRule/DiagTrees", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures no cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentNoTreesTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures no cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentDiagTentsTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures two cases are created, one connecting the tree and the
+ * left tent, and one connecting the tree and the right tent.
+ * Because tents must be surrounded by grass, there can be at most
+ * two tents around a given tree.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentTwoTentsTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTreeCaseRule/TwoTents", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Ensures one case is created that connects the tree to the tent.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentOneTentTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTreeCaseRule/OneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList
checks that 1 case is created and that all three UNKNOWN tiles have become tents
+// *
+// * @throws InvalidFileFormatException
+// */
+// @Test
+// public void FillInRowPartialFillThreeTent() throws InvalidFileFormatException {
+// TestUtilities.importTestBoard(
+// "puzzles/treetent/rules/FillinRowCaseRule/PartialFillOneTent", treetent);
+// TreeNode rootNode = treetent.getTree().getRootNode();
+// TreeTransition transition = rootNode.getChildren().get(0);
+// transition.setRule(RULE);
+//
+// TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+// TreeTentClue testing_row = board.getClue(1, 7);
+// ArrayList Make sure the list elements are lowercase
+ *
+ * @return A list of elements that will change when solving the puzzle
+ * * e.g. {"cell"}, {"cell", "line"}
+ */
+ public List 3x3 board with trees at (1, 0) and (1, 2) and a tent at (1, 1). Creating a line
+ * from (1, 0) to (1, 1) works because there is only one tent adjacent to the tree
+ * at (1, 0)
*/
@Test
- public void TentForTreeOneTreeTwoTentTest() throws InvalidFileFormatException {
+ public void TentForTreeArbitraryTreeTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
- "puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeTwoTent",
+ "puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree",
treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -85,24 +89,21 @@ public void TentForTreeOneTreeTwoTentTest() throws InvalidFileFormatException {
board.getLines().add(line);
Assert.assertNull(RULE.checkRule(transition));
-
- ArrayList 3x3 Board with Trees at (1, 0) and (1, 2) and a Tent at (1, 1)
+ * A Preexisting line connects the tent at (1, 0) and the central tent
+ * Therefore, the tree at (1, 2) does not have a valid tent adjacent to it
*/
- //TODO
- // Currently Cannot Create a board with a pre-existing line.
@Test
- public void TentForTreeOneTreeConnectedTent() throws InvalidFileFormatException {
+ public void TentForTreeConnectedTent() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
- "puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeTwoTent",
+ "puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree",
treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -125,4 +126,33 @@ public void TentForTreeOneTreeConnectedTent() throws InvalidFileFormatException
Assert.assertNotNull(RULE.checkRuleAt(transition, l));
}
}
+
+ /***
+ * @throws InvalidFileFormatException Test to check if attempting to connect a tree to
+ * a tent when there are two possibilities fails
+ *
+ * 3x3 Board with Tree at (1, 1) and Tents at (1, 0) and (1, 2)
+ * The central tree has two possible tents to connect to, so the rule should fail
+ */
+ @Test
+ public void TentForTreeOneTreeTwoAdjacentTent() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/TentForTreeDirectRule/OneTreeTwoAdjacentTent",
+ treetent);
+
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(1, 2);
+ TreeTentCell cell2 = board.getCell(1, 1);
+ TreeTentLine line = new TreeTentLine(cell1, cell2);
+
+ board.addModifiedData(line);
+ board.getLines().add(line);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
}
diff --git a/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
index f4ea6703b..306bfabe6 100644
--- a/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
@@ -1,14 +1,154 @@
package puzzles.treetent.rules;
-// This feature is no longer supported
+import edu.rpi.legup.model.tree.TreeNode;
+import edu.rpi.legup.model.tree.TreeTransition;
+import edu.rpi.legup.puzzle.treetent.TreeTent;
+import edu.rpi.legup.puzzle.treetent.TreeTentBoard;
+import edu.rpi.legup.puzzle.treetent.TreeTentCell;
+import edu.rpi.legup.puzzle.treetent.TreeTentLine;
+import edu.rpi.legup.puzzle.treetent.rules.TreeForTentDirectRule;
+import edu.rpi.legup.save.InvalidFileFormatException;
+import legup.MockGameBoardFacade;
+import legup.TestUtilities;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.ArrayList;
+
public class TreeForTentDirectRuleTest {
- // private static final TreeForTentBasicRule RULE = new TreeForTentBasicRule();
- // private static TreeTent treetent;
+ private static final TreeForTentDirectRule RULE = new TreeForTentDirectRule();
+ private static TreeTent treetent;
+
+ @BeforeClass
+ public static void setUp() {
+ MockGameBoardFacade.getInstance();
+ treetent = new TreeTent();
+ }
+
+ /***
+ * @throws InvalidFileFormatException Test to check that a line connecting a tree and tent
+ * that are only adjacent to each other is valid
+ *
+ * 3x3 Board with Tree at (1, 0) and a Tent at (1, 1)
+ */
+ @Test
+ public void TreeForTentTestOneTreeOneTentTest() throws InvalidFileFormatException {
+
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/TreeForTentDirectRule/OneTentOneTree",
+ treetent);
+
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(1, 0);
+ TreeTentCell cell2 = board.getCell(1, 1);
+ TreeTentLine line = new TreeTentLine(cell1, cell2);
+
+ board.addModifiedData(line);
+ board.getLines().add(line);
+
+ Assert.assertNull(RULE.checkRule(transition));
+ }
+
+ /***
+ * @throws InvalidFileFormatException Test to check that a line connecting a tree to a tent
+ * while there are multiple tents around the tree works
+ *
+ * 3x3 board with tents at (1, 0) and (1, 2) and a tree at (1, 1). Creating a line
+ * from (1, 0) to (1, 1) works because there is only one tree adjacent to the tent
+ * at (1, 0)
+ */
+ @Test
+ public void TentForTreeArbitraryTreeTest() throws InvalidFileFormatException {
+
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/TreeForTentDirectRule/ArbitraryTent",
+ treetent);
+
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(1, 0);
+ TreeTentCell cell2 = board.getCell(1, 1);
+ TreeTentLine line = new TreeTentLine(cell1, cell2);
+
+ board.addModifiedData(line);
+ board.getLines().add(line);
+
+ Assert.assertNull(RULE.checkRule(transition));
+ }
+
+ /***
+ * @throws InvalidFileFormatException Test to check if attempting to connect a tent to
+ * an already connected tree fails
+ *
+ * 3x3 Board with Tents at (1, 0) and (1, 2) and a Tree at (1, 1)
+ * A Preexisting line connects the tent at (1, 0) and the central tree
+ * Therefore, the tent at (1, 2) does not have a valid tree adjacent to it
+ */
+ @Test
+ public void TentForTreeConnectedTent() throws InvalidFileFormatException {
+
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/TreeForTentDirectRule/ConnectedTree",
+ treetent);
+
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(1, 2);
+ TreeTentCell cell2 = board.getCell(1, 1);
+ TreeTentLine line = new TreeTentLine(cell1, cell2);
+
+ board.addModifiedData(line);
+ board.getLines().add(line);
+
+ Assert.assertNull(RULE.checkRule(transition));
+
+ ArrayList 3x3 Board with Tent at (1, 1) and Trees at (1, 0) and (1, 2)
+ * The central tent has two possible trees to connect to, so the rule should fail
+ */
+ @Test
+ public void TentForTreeOneTreeTwoAdjacentTent() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/TreeForTentDirectRule/OneTentTwoAdjacentTrees",
+ treetent);
+
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(1, 2);
+ TreeTentCell cell2 = board.getCell(1, 1);
+ TreeTentLine line = new TreeTentLine(cell1, cell2);
+
+ board.addModifiedData(line);
+ board.getLines().add(line);
- // @BeforeClass
- // public static void setUp() {
- // MockGameBoardFacade.getInstance();
- // treetent = new TreeTent();
- // }
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
}
diff --git a/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeTwoTent b/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree
similarity index 100%
rename from src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeTwoTent
rename to src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree
diff --git a/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeConnectedTent b/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/ConnectedTent
similarity index 100%
rename from src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeConnectedTent
rename to src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/ConnectedTent
index fccd529a3..031bca068 100644
--- a/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/TentForTreeOneTreeConnectedTent
+++ b/src/test/resources/puzzles/treetent/rules/TentForTreeDirectRule/ConnectedTent
@@ -3,7 +3,6 @@
checks that 6 cases are created and each case has the right number of tents
+ *
+ * @throws InvalidFileFormatException
+ */
@Test
public void FillInRowEmpty5x5TwoTentClue() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
@@ -405,51 +413,51 @@ public void FillInRowEmpty5x5TwoTentClue() throws InvalidFileFormatException {
}
}
-// /**
-// * 7x3 TreeTent puzzle Tests FillinRowCaseRule on col with 3 UNKNOWN tiles separated by grass
-// * tiles and a clue of 3 tents in the col.
-// *
-// * checks that 1 case is created and that all three UNKNOWN tiles have become tents
-// *
-// * @throws InvalidFileFormatException
-// */
-// @Test
-// public void FillInRowPartialFillThreeTent() throws InvalidFileFormatException {
-// TestUtilities.importTestBoard(
-// "puzzles/treetent/rules/FillinRowCaseRule/PartialFillOneTent", treetent);
-// TreeNode rootNode = treetent.getTree().getRootNode();
-// TreeTransition transition = rootNode.getChildren().get(0);
-// transition.setRule(RULE);
-//
-// TreeTentBoard board = (TreeTentBoard) transition.getBoard();
-// TreeTentClue testing_row = board.getClue(1, 7);
-// ArrayList checks that 1 case is created and that all three UNKNOWN tiles have become tents
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void FillInRowPartialFillThreeTent() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/FillinRowCaseRule/PartialFillOneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentClue testing_col = board.getClue(1, 7);
+ ArrayList checks that 1 case is created and that it is equivalent to FinishWithGrass rule
+ * May need to change checks due to issue #777
*
* @throws InvalidFileFormatException
*/
@@ -318,8 +319,8 @@ public void FillInRowEmptyThreeTentClue() throws InvalidFileFormatException {
}
/**
- * empty 5x5 TreeTent puzzle Tests FillinRowCaseRule on row with 3 UNKNOWN tiles separated
- * by 2 GRASS tiles and a clue of 2 tents in the row.
+ * empty 5x5 TreeTent puzzle Tests FillinRowCaseRule on row with 5 UNKNOWN tiles
+ * and a clue of 2 tents in the row.
*
* checks that 6 cases are created and each case has the right number of tents
*
diff --git a/src/test/java/puzzles/treetent/rules/LinkTentCaseRuleTest.java b/src/test/java/puzzles/treetent/rules/LinkTentCaseRuleTest.java
index 702a500e2..3ed1fd79e 100644
--- a/src/test/java/puzzles/treetent/rules/LinkTentCaseRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/LinkTentCaseRuleTest.java
@@ -27,6 +27,54 @@ public static void setUp() {
treetent = new TreeTent();
}
+ /**
+ * empty 3x3 TreeTent puzzle Tests LinkTentCaseRule on a central tent
+ * with one tree surrounding it.
+ *
+ * checks that 1 cases is with the line connecting the central tent and the tree
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentOneTreeTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTentCaseRule/OneTreeOneTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList checks that 1 cases is with the line connecting the central tent and the tree
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void LinkTentOneTreeTest() throws InvalidFileFormatException {
- TestUtilities.importTestBoard(
- "puzzles/treetent/rules/LinkTentCaseRule/OneTreeOneTent", treetent);
- TreeNode rootNode = treetent.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- TreeTentBoard board = (TreeTentBoard) transition.getBoard();
- TreeTentCell test_location = board.getCell(1, 1);
- ArrayList Ensures no cases are created
+ * Ensures one case is created that connects the tree to the tent.
*
* @throws InvalidFileFormatException
*/
@Test
- public void LinkTentNoTreesTest() throws InvalidFileFormatException {
+ public void LinkTentOneTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
- "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
+ "puzzles/treetent/rules/LinkTreeCaseRule/OneTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
@@ -49,31 +49,31 @@ public void LinkTentNoTreesTest() throws InvalidFileFormatException {
ArrayList Ensures no cases are created
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void LinkTentDiagTentsTest() throws InvalidFileFormatException {
- TestUtilities.importTestBoard(
- "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
- TreeNode rootNode = treetent.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
+ TreeTentLine expectedLine = new TreeTentLine(board.getCell(1, 1), board.getCell(1, 0));
- TreeTentBoard board = (TreeTentBoard) transition.getBoard();
- TreeTentCell test_location = board.getCell(1, 1);
- ArrayList Ensures one case is created that connects the tree to the tent.
+ * Ensures no cases are created
*
* @throws InvalidFileFormatException
*/
@Test
- public void LinkTentOneTentTest() throws InvalidFileFormatException {
+ public void LinkTentNoTreesTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
- "puzzles/treetent/rules/LinkTreeCaseRule/OneTent", treetent);
+ "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
@@ -163,30 +163,30 @@ public void LinkTentOneTentTest() throws InvalidFileFormatException {
ArrayList Ensures no cases are created
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void LinkTentDiagTentsTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard(
+ "puzzles/treetent/rules/LinkTreeCaseRule/NoTents", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
- // checks other cells have not been modified
- TreeTentCell original_cell;
- TreeTentCell case_cell;
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+ TreeTentCell test_location = board.getCell(1, 1);
+ ArrayList Empty
+ * XXX
+ * XGX
+ * XXX
+ * Makes the (1, 1) tile GRASS
+ */
+ @Test
+ public void EmptyFieldTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/EmptyFieldDirectRule/EmptyField", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -64,12 +69,16 @@ public void EmptyFieldTest() throws InvalidFileFormatException {
}
}
- // creates a 3x3 puzzle with 4 trees
- // trees are at (0,0), (2,0), (0,2), and (2,2)
- // make the (1,1) tile GRASS.
- // checks if tiles logically follow the EmptyFieldDirectRule
- @Test
- public void DiagonalTreeTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests EmptyFieldDirectRule
+ * Trees are at (0, 0), (2, 0), (0, 2), and (2, 2)
+ * RXR
+ * XGX
+ * RXR
+ * Makes the (1, 1) tile GRASS
+ */
+ @Test
+ public void DiagonalTreeTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/EmptyFieldDirectRule/DiagonalTree", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -103,12 +112,16 @@ public void DiagonalTreeTest() throws InvalidFileFormatException {
}
}
- // creates a 3x3 puzzle with 4 trees
- // trees are at (0,1), (1,0), (1,2), and (2,1)
- // make the (1,1) tile GRASS.
- // checks if tiles don't logically follow the EmptyFieldDirectRule
- @Test
- public void EmptyFieldTestFail() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests EmptyFieldDirectRule
+ * Trees are at (0, 1), (1, 0), (1, 2), and (2, 1)
+ * XRX
+ * RGR
+ * XRX
+ * Makes the (1, 1) tile GRASS
+ */
+ @Test
+ public void EmptyFieldTestFail() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFail", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -137,12 +150,16 @@ public void EmptyFieldTestFail() throws InvalidFileFormatException {
}
}
- // creates a 3x3 puzzle with 1 tree
- // tree is at (1,0)
- // make the (1,1) tile GRASS.
- // checks if tiles don't logically follow the EmptyFieldDirectRule
- @Test
- public void EmptyFieldTestFailTop() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests EmptyFieldDirectRule
+ * Tree at (1, 0)
+ * XRX
+ * XGX
+ * XXX
+ * Makes the (1, 1) tile GRASS
+ */
+ @Test
+ public void EmptyFieldTestFailTop() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailTop", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -170,106 +187,4 @@ public void EmptyFieldTestFailTop() throws InvalidFileFormatException {
}
}
}
-
- // creates a 3x3 puzzle with 1 tree
- // tree is at (1,2)
- // make the (1,1) tile GRASS.
- // checks if tiles don't logically follow the EmptyFieldDirectRule
- @Test
- public void EmptyFieldTestFailTopBottom() throws InvalidFileFormatException {
- TestUtilities.importTestBoard(
- "puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailBottom", treetent);
- TreeNode rootNode = treetent.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // get board state
- TreeTentBoard board = (TreeTentBoard) transition.getBoard();
-
- // change the board's cells considering breaking the EmptyField rule
- TreeTentCell cell1 = board.getCell(1, 1);
- cell1.setData(TreeTentType.GRASS);
- board.addModifiedData(cell1);
-
- // confirm there is not a logical following of the EmptyField rule
- Assert.assertNotNull(RULE.checkRule(transition));
-
- // the cells should not follow the rule
- TreeTentCell c;
- for (int i = 0; i < board.getWidth(); i++) {
- for (int j = 0; j < board.getHeight(); j++) {
- c = board.getCell(j, i);
- // does not use the rule to logically follow
- Assert.assertNotNull(RULE.checkRuleAt(transition, c));
- }
- }
- }
-
- // creates a 3x3 puzzle with 1 tree
- // tree is at (0,1)
- // make the (1,1) tile GRASS.
- // checks if tiles don't logically follow the EmptyFieldDirectRule
- @Test
- public void EmptyFieldTestFailLeft() throws InvalidFileFormatException {
- TestUtilities.importTestBoard(
- "puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailLeft", treetent);
- TreeNode rootNode = treetent.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // get board state
- TreeTentBoard board = (TreeTentBoard) transition.getBoard();
-
- // change the board's cells considering breaking the EmptyField rule
- TreeTentCell cell1 = board.getCell(1, 1);
- cell1.setData(TreeTentType.GRASS);
- board.addModifiedData(cell1);
-
- // confirm there is not a logical following of the EmptyField rule
- Assert.assertNotNull(RULE.checkRule(transition));
-
- // the cells should not follow the rule
- TreeTentCell c;
- for (int i = 0; i < board.getWidth(); i++) {
- for (int j = 0; j < board.getHeight(); j++) {
- c = board.getCell(j, i);
- // does not use the rule to logically follow
- Assert.assertNotNull(RULE.checkRuleAt(transition, c));
- }
- }
- }
-
- // creates a 3x3 puzzle with 1 tree
- // tree is at (2,1)
- // make the (1,1) tile GRASS.
- // checks if tiles don't logically follow the EmptyFieldDirectRule
- @Test
- public void EmptyFieldTestFailRight() throws InvalidFileFormatException {
- TestUtilities.importTestBoard(
- "puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailRight", treetent);
- TreeNode rootNode = treetent.getTree().getRootNode();
- TreeTransition transition = rootNode.getChildren().get(0);
- transition.setRule(RULE);
-
- // get board state
- TreeTentBoard board = (TreeTentBoard) transition.getBoard();
-
- // change the board's cells considering breaking the EmptyField rule
- TreeTentCell cell1 = board.getCell(1, 1);
- cell1.setData(TreeTentType.GRASS);
- board.addModifiedData(cell1);
-
- // confirm there is not a logical following of the EmptyField rule
- Assert.assertNotNull(RULE.checkRule(transition));
-
- // the cells should not follow the rule
- TreeTentCell c;
- for (int i = 0; i < board.getWidth(); i++) {
- for (int j = 0; j < board.getHeight(); j++) {
- c = board.getCell(j, i);
- // does not use the rule to logically follow
- Assert.assertNotNull(RULE.checkRuleAt(transition, c));
- }
- }
- }
}
diff --git a/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
index 0783ab8b8..71b88d156 100644
--- a/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
@@ -28,14 +28,17 @@ public static void setUp() {
treetent = new TreeTent();
}
- /**
- * 3x3 TreeTent puzzle with a tent at (0,0) Tests FinishWithGrassDirectRule on GRASS tiles
- * horizontal of the tent at (1,0) and (2,0)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithGrassHorizontalTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Tent at (1, 1)
+ * XXX x
+ * GTG 1
+ * XXX x
+ * xxx
+ * Makes (0, 1) and (2, 1) GRASS
+ */
+ @Test
+ public void FinishWithGrassHorizontalTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/CornerTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -74,14 +77,17 @@ public void FinishWithGrassHorizontalTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a tent at (0,0) Tests FinishWithGrassDirectRule on GRASS tiles
- * vertical of the tent at (0,1) and (0,2)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithGrassVerticalTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Tent at (0, 0)
+ * TXX x
+ * GXX x
+ * GXX x
+ * 1xx
+ * Makes (0, 1) and (0, 2) GRASS
+ */
+ @Test
+ public void FinishWithGrassVerticalTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/CornerTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -121,10 +127,13 @@ public void FinishWithGrassVerticalTest() throws InvalidFileFormatException {
}
/**
- * 3x3 TreeTent puzzle with a tent at (0,0) Tests FinishWithGrassDirectRule on GRASS tiles at
- * (1,0), (2,0), (0,1), and (0,2)
- *
- * @throws InvalidFileFormatException
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Tent at (0, 0)
+ * TGG 1
+ * GXX x
+ * GXX x
+ * 1xx
+ * Makes (0, 1), (0, 2), (1, 0), and (2, 0) GRASS
*/
@Test
public void FinishWithGrassTest() throws InvalidFileFormatException {
@@ -174,14 +183,17 @@ public void FinishWithGrassTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with no tents Tests FinishWithGrassDirectRule on GRASS tiles GRASS tiles
- * fill entire board
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void NoTentTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Empty
+ * GGG 0
+ * GGG 0
+ * GGG 0
+ * 000
+ * Fill Board with GRASS
+ */
+ @Test
+ public void NoTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/NoTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -215,14 +227,17 @@ public void NoTentTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a tent at (1,1) Tests FinishWithGrassDirectRule on GRASS tiles
- * surrounding the tent at (1,0), (0,1), (2,1), and (1,2)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void MiddleTentTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Tent at (1, 1)
+ * XGX x
+ * GTG 1
+ * XGX x
+ * x1x
+ * Makes (1, 0), (0, 1), (2, 1), and (1, 2) GRASS
+ */
+ @Test
+ public void MiddleTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/MiddleTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -270,14 +285,17 @@ public void MiddleTentTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with missing tents Tests FinishWithGrassDirectRule on GRASS tiles filling
- * the puzzle all GRASS tiles should fail the FinishWithGrassDirectRule
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FailTentTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Empty
+ * GGG 1
+ * GGG 1
+ * GGG 1
+ * 111
+ * Fill Board with GRASS
+ */
+ @Test
+ public void FailTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/FailTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -311,14 +329,21 @@ public void FailTentTest() throws InvalidFileFormatException {
}
}
- /**
- * 7x7 TreeTent puzzle with multiple tents spaced out Tests FinishWithGrassDirectRule on GRASS
- * tiles between the tents at (0,3), (2,3), (4,3), and (6,3)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void SpacedOutTentTest() throws InvalidFileFormatException {
+ /**
+ * 7x7 TreeTent puzzle Tests FinishWithGrassDirectRule
+ * Tents at (1, 3), (3, 3), and (5, 3)
+ * XXXXXXX x
+ * XXXXXXX x
+ * XXXXXXX x
+ * TGTGTGT 4
+ * XXXXXXX x
+ * XXXXXXX x
+ * XXXXXXX x
+ * xxxxxxx
+ * Makes (0, 3), (2, 3), (4, 3), and (6, 3) GRASS
+ */
+ @Test
+ public void SpacedOutTentTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithGrassDirectRule/SpacedOutTent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
diff --git a/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
index 652af615f..ed9dd8bae 100644
--- a/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
@@ -27,14 +27,17 @@ public static void setUp() {
treetent = new TreeTent();
}
- /**
- * 3x3 TreeTent puzzle with a GRASS tile at (0,0) Tests FinishWithTentsDirectRule on TENT tiles
- * horizontal of the GRASS tile at (1,0) and (2,0)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithHorizontalTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Grass at (0, 0)
+ * GTT 2
+ * XXX x
+ * XXX x
+ * xxx
+ * Makes (1, 0) and (2, 0) GRASS
+ */
+ @Test
+ public void FinishWithHorizontalTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/FinishWithHorizontalTents",
treetent);
@@ -67,14 +70,17 @@ public void FinishWithHorizontalTentsTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a GRASS tile at (0,0) Tests FinishWithTentsDirectRule on TENT tiles
- * vertical of the GRASS tile at (0,1) and (0,2)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithVerticalTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Grass at (0, 0)
+ * GXX x
+ * TXX x
+ * TXX x
+ * 2xx
+ * Makes (0, 1) and (0, 2) GRASS
+ */
+ @Test
+ public void FinishWithVerticalTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/FinishWithVerticalTents",
treetent);
diff --git a/src/test/resources/puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailBottom b/src/test/resources/puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailBottom
deleted file mode 100644
index 80deadaea..000000000
--- a/src/test/resources/puzzles/treetent/rules/EmptyFieldDirectRule/EmptyFieldFailBottom
+++ /dev/null
@@ -1,20 +0,0 @@
- Makes the (1, 1) tile GRASS
+ * Checks if the rule correctly detects no trees around the grass tile
*/
@Test
public void EmptyFieldTest() throws InvalidFileFormatException {
@@ -76,6 +77,7 @@ public void EmptyFieldTest() throws InvalidFileFormatException {
* XGX
* RXR
* Makes the (1, 1) tile GRASS
+ * Checks if the rule correctly ignores the trees on the diagonals
*/
@Test
public void DiagonalTreeTest() throws InvalidFileFormatException {
@@ -119,6 +121,7 @@ public void DiagonalTreeTest() throws InvalidFileFormatException {
* RGR
* XRX
* Makes the (1, 1) tile GRASS
+ * Checks if the rule is not valid when there are adjacent trees
*/
@Test
public void EmptyFieldTestFail() throws InvalidFileFormatException {
@@ -157,6 +160,7 @@ public void EmptyFieldTestFail() throws InvalidFileFormatException {
* XGX
* XXX
* Makes the (1, 1) tile GRASS
+ * Checks if the rule is not valid when there is one adjacent tree
*/
@Test
public void EmptyFieldTestFailTop() throws InvalidFileFormatException {
diff --git a/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
index 71b88d156..f37761e26 100644
--- a/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/FinishWithGrassDirectRuleTest.java
@@ -36,6 +36,7 @@ public static void setUp() {
* XXX x
* xxx
* Makes (0, 1) and (2, 1) GRASS
+ * Checks if the rule detects the middle row to be filled in correctly
*/
@Test
public void FinishWithGrassHorizontalTest() throws InvalidFileFormatException {
@@ -85,6 +86,7 @@ public void FinishWithGrassHorizontalTest() throws InvalidFileFormatException {
* GXX x
* 1xx
* Makes (0, 1) and (0, 2) GRASS
+ * Checks if the rule detects the leftmost column to be filled in correctly
*/
@Test
public void FinishWithGrassVerticalTest() throws InvalidFileFormatException {
@@ -134,6 +136,7 @@ public void FinishWithGrassVerticalTest() throws InvalidFileFormatException {
* GXX x
* 1xx
* Makes (0, 1), (0, 2), (1, 0), and (2, 0) GRASS
+ * Checks if the rule detects the top row and leftmost column to be filled in correctly
*/
@Test
public void FinishWithGrassTest() throws InvalidFileFormatException {
@@ -191,6 +194,7 @@ public void FinishWithGrassTest() throws InvalidFileFormatException {
* GGG 0
* 000
* Fill Board with GRASS
+ * Checks if the rule allows all cells to be filled when the clue for all rows and columns is zero.
*/
@Test
public void NoTentTest() throws InvalidFileFormatException {
@@ -235,6 +239,7 @@ public void NoTentTest() throws InvalidFileFormatException {
* XGX x
* x1x
* Makes (1, 0), (0, 1), (2, 1), and (1, 2) GRASS
+ * Checks if the rule correctly allows the central row and column to be filled with grass.
*/
@Test
public void MiddleTentTest() throws InvalidFileFormatException {
@@ -293,6 +298,7 @@ public void MiddleTentTest() throws InvalidFileFormatException {
* GGG 1
* 111
* Fill Board with GRASS
+ * Checks if the rule is not valid when a row or column does not have the required number of tents but is filled with grass
*/
@Test
public void FailTentTest() throws InvalidFileFormatException {
@@ -341,6 +347,7 @@ public void FailTentTest() throws InvalidFileFormatException {
* XXXXXXX x
* xxxxxxx
* Makes (0, 3), (2, 3), (4, 3), and (6, 3) GRASS
+ * Checks if applying the rule on row 3 is valid
*/
@Test
public void SpacedOutTentTest() throws InvalidFileFormatException {
diff --git a/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
index ed9dd8bae..d82be3f87 100644
--- a/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/FinishWithTentsDirectRuleTest.java
@@ -34,7 +34,8 @@ public static void setUp() {
* XXX x
* XXX x
* xxx
- * Makes (1, 0) and (2, 0) GRASS
+ * Makes (1, 0) and (2, 0) TENT
+ * Checks that the rule correctly fills in the first row
*/
@Test
public void FinishWithHorizontalTentsTest() throws InvalidFileFormatException {
@@ -77,7 +78,8 @@ public void FinishWithHorizontalTentsTest() throws InvalidFileFormatException {
* TXX x
* TXX x
* 2xx
- * Makes (0, 1) and (0, 2) GRASS
+ * Makes (0, 1) and (0, 2) TENT
+ * Checks that the rule correctly fills in the first column
*/
@Test
public void FinishWithVerticalTentsTest() throws InvalidFileFormatException {
@@ -113,14 +115,18 @@ public void FinishWithVerticalTentsTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a GRASS tile at (1,1) Tests FinishWithTentsDirectRule on TENT tiles
- * around the GRASS tile at (1,0), (1,2), (0,1), and (2,1)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Grass at (0, 0)
+ * GTT 2
+ * TXX x
+ * TXX x
+ * 2xx
+ * Makes (1, 0), (2, 0), (0, 1) and (0, 2) TENT
+ * Checks that the rule correctly fills both the first row and first column
+ */
+ @Test
+ public void FinishWithTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/FinishWithTents", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -161,14 +167,18 @@ public void FinishWithTentsTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a TENT tile at (1,1) Tests FinishWithTentsDirectRule on TENT tiles
- * around the TENT tile at (1,0), (1,2), (0,1), and (2,1)
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void AdditionalTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Tent at (1, 1)
+ * XTX x
+ * TTT 3
+ * XTX x
+ * x3x
+ * Makes (1, 0), (0, 1), (2, 1), and (1, 2) TENT
+ * Checks that the rule correctly fills in the middle row and column when a tent starts at (1, 1)
+ */
+ @Test
+ public void AdditionalTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/AdditionalTents", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -209,14 +219,18 @@ public void AdditionalTentsTest() throws InvalidFileFormatException {
}
}
- /**
- * Empty 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule on TENT tiles of entire puzzle all
- * TENT tiles should fail FinishWithTentsDirectRule as no TENT tiles should be there
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void FinishWithTentsFailTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Empty
+ * TTT 0
+ * TTT 0
+ * TTT 0
+ * 000
+ * Fills the board with tents
+ * Checks that the rule does not allow for more tents in any of the rows or columns
+ */
+ @Test
+ public void FinishWithTentsFailTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/FinishWithTentsFail", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -245,15 +259,18 @@ public void FinishWithTentsFailTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a TENT tile at (1,1) Tests FinishWithTentsDirectRule on TENT tiles
- * around the TENT tile at (1,0), (1,2), (0,1), and (2,1) all TENT tiles should fail
- * FinishWithTentsDirectRule as there were already sufficient number of TENT tiles
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void TooManyTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Tent at (1, 1)
+ * XTX x
+ * TTT 1
+ * XTX x
+ * x1x
+ * Makes (1, 0), (0, 1), (2, 1) and (1, 2) Tent
+ * Checks that the rule does not allow for more tents in the central row or central column
+ */
+ @Test
+ public void TooManyTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/TooManyTents", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -285,16 +302,18 @@ public void TooManyTentsTest() throws InvalidFileFormatException {
}
}
- /**
- * 3x3 TreeTent puzzle with a TENT tile at (1,1) Tests FinishWithTentsDirectRule on TENT tiles
- * around the TENT tile at (1,0), (1,2), (0,1), and (2,1) all TENT tiles should fail
- * FinishWithTentsDirectRule as there are multiple configurations of the placement of the TENT
- * tiles
- *
- * @throws InvalidFileFormatException
- */
- @Test
- public void AmbiguousTentsTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests FinishWithTentsDirectRule
+ * Tent at (1, 1)
+ * XTX x
+ * TTT 2
+ * XTX x
+ * x2x
+ * Makes (1, 0), (0, 1), (2, 1) and (1, 2) Tent
+ * Checks that the rule is not satisfied because there are multiple configurations of tents for the central row and central column
+ */
+ @Test
+ public void AmbiguousTentsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/FinishWithTentsDirectRule/AmbiguousTents", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
diff --git a/src/test/java/puzzles/treetent/rules/LastCampingSpotDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/LastCampingSpotDirectRuleTest.java
index 92d6e4a59..ad4559922 100644
--- a/src/test/java/puzzles/treetent/rules/LastCampingSpotDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/LastCampingSpotDirectRuleTest.java
@@ -26,13 +26,17 @@ public static void setUp() {
treetent = new TreeTent();
}
- /**
- * @throws InvalidFileFormatException
- * Checks if a test works for an empty square above a tree which is surrounded on all
- * other sides.
- */
- @Test
- public void EmptyFieldTest_Up() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests LastCampingSpotDirectRule
+ * TREE at (1, 1) and (0, 1); GRASS at (1, 2) and (2, 1)
+ * XTX
+ * RRG
+ * XGX
+ * Makes (1, 0) TENT
+ * Checks that a tent must be placed above the central tree
+ */
+ @Test
+ public void EmptyFieldTest_Up() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/LastCampingSpotDirectRule/LastCampingSpotUp", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -60,13 +64,17 @@ public void EmptyFieldTest_Up() throws InvalidFileFormatException {
}
}
- /**
- * @throws InvalidFileFormatException
- * Checks if a test works for an empty square below a tree which is surrounded on all
- * other sides.
- */
- @Test
- public void EmptyFieldTest_Down() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests LastCampingSpotDirectRule
+ * TREE at (1, 1) and (0, 1); GRASS at (1, 0) and (1, 2)
+ * XGX
+ * RRG
+ * XTX
+ * Makes (1, 2) TENT
+ * Checks that a tent must be placed below the central tree
+ */
+ @Test
+ public void EmptyFieldTest_Down() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/LastCampingSpotDirectRule/LastCampingSpotDown", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -94,13 +102,17 @@ public void EmptyFieldTest_Down() throws InvalidFileFormatException {
}
}
- /**
- * @throws InvalidFileFormatException
- * Checks if a test works for an empty square to the left of a tree which is surrounded
- * on all other sides.
- */
- @Test
- public void EmptyFieldTest_Left() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests LastCampingSpotDirectRule
+ * TREE at (1, 1) and (2, 1); GRASS at (1, 0) and (1, 2)
+ * XGX
+ * TRR
+ * XGX
+ * Makes (0, 1) TENT
+ * Checks that a tent must be placed on the left of the central tree
+ */
+ @Test
+ public void EmptyFieldTest_Left() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/LastCampingSpotDirectRule/LastCampingSpotLeft", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
@@ -128,13 +140,17 @@ public void EmptyFieldTest_Left() throws InvalidFileFormatException {
}
}
- /**
- * @throws InvalidFileFormatException
- * Checks if a test works for an empty square to the right of a tree which is surrounded
- * on all other sides.
- */
- @Test
- public void EmptyFieldTest_Right() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests LastCampingSpotDirectRule
+ * TREE at (1, 1) and (1, 2); GRASS at (0, 1) and (1, 0)
+ * XGX
+ * GRT
+ * XRX
+ * Makes (2, 1) TENT
+ * Checks that a tent must be placed to the right of the central tree
+ */
+ @Test
+ public void EmptyFieldTest_Right() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/LastCampingSpotDirectRule/LastCampingSpotRight", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
diff --git a/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
index 7ff57a052..6177bb64c 100644
--- a/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
@@ -27,12 +27,17 @@ public static void setUp() {
treetent = new TreeTent();
}
- /**
- * @throws InvalidFileFormatException Test to check if all adjacent and diagonals not filled
- * with a tree are filled with grass
- */
- @Test
- public void SurroundTentWithGrassBasicRuleTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests SurroundTentWithGrassDirectRule
+ * TREE at (0, 0), (2, 0), (0, 1), (2, 1), (1, 2), and (2, 2); TENT at (1, 1)
+ * RGR
+ * RTR
+ * GRR
+ * Makes (1, 0) and (0, 2) GRASS
+ * Checks that the rule detects unknown adjacent and diagonal tiles correctly
+ */
+ @Test
+ public void SurroundTentWithGrassBasicRuleTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrass",
treetent);
@@ -64,14 +69,17 @@ public void SurroundTentWithGrassBasicRuleTest() throws InvalidFileFormatExcepti
}
}
- /**
- * @throws InvalidFileFormatException
- * Test with a 3x3 board with an absolutely empty area aside from a tent in the middle
- * While such a situation is an illegal treetent setup, this direct rule doesn't consider
- * that aspect, so its ok in this context
- */
- @Test
- public void SurroundTentWithGrassBasicRuleTest_BadBoard() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests SurroundTentWithGrassDirectRule
+ * TENT at (1, 1)
+ * GGG
+ * GTG
+ * GGG
+ * Makes all cells adjacent and diagonal to the tent GRASS
+ * Checks that the rule detects all adjacent and diagonal tiles correctly
+ */
+ @Test
+ public void SurroundTentWithGrassBasicRuleTest_BadBoard() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassBad",
treetent);
@@ -129,13 +137,17 @@ public void SurroundTentWithGrassBasicRuleTest_BadBoard() throws InvalidFileForm
}
}
- /**
- * @throws InvalidFileFormatException
- * Test to see if the rule passes even if no grass was able to be placed due to the
- * presence of trees.
- */
- @Test
- public void SurroundTentWithGrassBasicRuleTest_FullBoard() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests SurroundTentWithGrassDirectRule
+ * TENT at (1, 1); TREE on all adjacent and diagonal tiles
+ * RRR
+ * RTR
+ * RRR
+ * Null
+ * Checks that the rule correctly detects no missing tiles
+ */
+ @Test
+ public void SurroundTentWithGrassBasicRuleTest_FullBoard() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassTrees",
treetent);
diff --git a/src/test/java/puzzles/treetent/rules/TentForTreeDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/TentForTreeDirectRuleTest.java
index 76f2b9b02..e55704ec2 100644
--- a/src/test/java/puzzles/treetent/rules/TentForTreeDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/TentForTreeDirectRuleTest.java
@@ -24,9 +24,14 @@ public static void setUp() {
treetent = new TreeTent();
}
- /***
- * @throws InvalidFileFormatException Test to check that a line connecting a tree and tent
- * that are only adjacent to each other is valid
+ /**
+ * 3x3 TreeTent puzzle Tests TentForTreeDirectRule
+ * TREE at (1, 0); TENT at (1, 1)
+ * XRX
+ * XTX
+ * XXX
+ * Makes a line between (1, 0) and (1, 1)
+ * Checks that the rule correctly detects the central tent as the only possible connection
*/
@Test
public void TentForTreeTestOneTreeOneTentTest() throws InvalidFileFormatException {
@@ -60,16 +65,17 @@ public void TentForTreeTestOneTreeOneTentTest() throws InvalidFileFormatExceptio
}
}
- /***
- * @throws InvalidFileFormatException Test to check that a line connecting a tent to a tree
- * while there are multiple trees around the tent works
- *
- * 3x3 board with trees at (1, 0) and (1, 2) and a tent at (1, 1). Creating a line
- * from (1, 0) to (1, 1) works because there is only one tent adjacent to the tree
- * at (1, 0)
- */
- @Test
- public void TentForTreeArbitraryTreeTest() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests TentForTreeDirectRule
+ * TREE at (1, 0) and (1, 2); TENT at (1, 1)
+ * XRX
+ * XTX
+ * XRX
+ * Makes a line between (1, 0) and (1, 1)
+ * Checks that the rule works when connecting a line between the tree at (1, 0) and tent at (1, 1)
+ */
+ @Test
+ public void TentForTreeArbitraryTreeTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree",
@@ -91,16 +97,17 @@ public void TentForTreeArbitraryTreeTest() throws InvalidFileFormatException {
Assert.assertNull(RULE.checkRule(transition));
}
- /***
- * @throws InvalidFileFormatException Test to check if attempting to connect a tree to
- * an already connected tent fails
- *
- * 3x3 Board with Trees at (1, 0) and (1, 2) and a Tent at (1, 1)
- * A Preexisting line connects the tent at (1, 0) and the central tent
- * Therefore, the tree at (1, 2) does not have a valid tent adjacent to it
- */
- @Test
- public void TentForTreeConnectedTent() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests TentForTreeDirectRule
+ * TREE at (1, 0) and (1, 2); TENT at (1, 1); LINE between (1, 0) and (1, 1)
+ * XRX
+ * XTX
+ * XRX
+ * Makes a line between (1, 1) and (1, 2)
+ * Checks that the rule fails for the tree at (1, 2) because there are no valid tents to connect to
+ */
+ @Test
+ public void TentForTreeConnectedTent() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/TentForTreeDirectRule/ArbitraryTree",
@@ -127,15 +134,17 @@ public void TentForTreeConnectedTent() throws InvalidFileFormatException {
}
}
- /***
- * @throws InvalidFileFormatException Test to check if attempting to connect a tree to
- * a tent when there are two possibilities fails
- *
- * 3x3 Board with Tree at (1, 1) and Tents at (1, 0) and (1, 2)
- * The central tree has two possible tents to connect to, so the rule should fail
- */
- @Test
- public void TentForTreeOneTreeTwoAdjacentTent() throws InvalidFileFormatException {
+ /**
+ * 3x3 TreeTent puzzle Tests TentForTreeDirectRule
+ * TREE at (1, 1); TENT at (1, 0) and (1, 2)
+ * XTX
+ * XRX
+ * XTX
+ * Makes a line between (1, 1) and (1, 2)
+ * Checks that the rule fails for the tree at (1, 1) because there are two valid tents to connect to
+ */
+ @Test
+ public void TentForTreeOneTreeTwoAdjacentTent() throws InvalidFileFormatException {
TestUtilities.importTestBoard(
"puzzles/treetent/rules/TentForTreeDirectRule/OneTreeTwoAdjacentTent",
treetent);
diff --git a/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
index a1bf040f6..ba1b49b8c 100644
--- a/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/TreeForTentDirectRuleTest.java
@@ -27,12 +27,15 @@ public static void setUp() {
treetent = new TreeTent();
}
- /***
- * @throws InvalidFileFormatException Test to check that a line connecting a tree and tent
- * that are only adjacent to each other is valid
- *
- * 3x3 Board with Tree at (1, 0) and a Tent at (1, 1)
- */
+ /**
+ * 3x3 TreeTent puzzle Tests TreeForTentDirectRule
+ * TENT at (1, 0); TREE at (1, 1)
+ * XTX
+ * XRX
+ * XXX
+ * Makes a line between (1, 0) and (1, 1)
+ * Checks that the rule correctly detects the central tree as the only possible connection
+ */
@Test
public void TreeForTentTestOneTreeOneTentTest() throws InvalidFileFormatException {
@@ -56,13 +59,14 @@ public void TreeForTentTestOneTreeOneTentTest() throws InvalidFileFormatExceptio
Assert.assertNull(RULE.checkRule(transition));
}
- /***
- * @throws InvalidFileFormatException Test to check that a line connecting a tree to a tent
- * while there are multiple tents around the tree works
- *
- * 3x3 board with tents at (1, 0) and (1, 2) and a tree at (1, 1). Creating a line
- * from (1, 0) to (1, 1) works because there is only one tree adjacent to the tent
- * at (1, 0)
+ /**
+ * 3x3 TreeTent puzzle Tests TreeForTentDirectRule
+ * TENT at (1, 0) and (1, 2); TREE at (1, 1)
+ * XTX
+ * XRX
+ * XTX
+ * Makes a line between (1, 0) and (1, 1)
+ * Checks that the rule works when connecting a line between the tent at (1, 0) and the tree at (1, 1)
*/
@Test
public void TentForTreeWithArbitraryTreeTest() throws InvalidFileFormatException {
@@ -87,13 +91,14 @@ public void TentForTreeWithArbitraryTreeTest() throws InvalidFileFormatException
Assert.assertNull(RULE.checkRule(transition));
}
- /***
- * @throws InvalidFileFormatException Test to check if attempting to connect a tent to
- * an already connected tree fails
- *
- * 3x3 Board with Tents at (1, 0) and (1, 2) and a Tree at (1, 1)
- * A Preexisting line connects the tent at (1, 0) and the central tree
- * Therefore, the tent at (1, 2) does not have a valid tree adjacent to it
+ /**
+ * 3x3 TreeTent puzzle Tests TreeForTentDirectRule
+ * TENT at (1, 0) and (1, 2); TREE at (1, 1); LINE between (1, 0) and (1, 1)
+ * XTX
+ * XRX
+ * XTX
+ * Makes a line between (1, 1) and (1, 2)
+ * Checks that the rule fails for the tent at (1, 2) because there are no valid trees to connect to
*/
@Test
public void TentForTreeConnectedTent() throws InvalidFileFormatException {
@@ -123,12 +128,14 @@ public void TentForTreeConnectedTent() throws InvalidFileFormatException {
}
}
- /***
- * @throws InvalidFileFormatException Test to check if attempting to connect a tent to
- * a tree when there are two trees fails
- *
- * 3x3 Board with Tent at (1, 1) and Trees at (1, 0) and (1, 2)
- * The central tent has two possible trees to connect to, so the rule should fail
+ /**
+ * 3x3 TreeTent puzzle Tests TreeForTentDirectRule
+ * TENT at (1, 1); TREE at (1, 0) and (1, 2)
+ * XRX
+ * XTX
+ * XRX
+ * Makes a line between (1, 1) and (1, 2)
+ * Checks that the rule fails for the tree at (1, 1) because there are two valid trees to connect to
*/
@Test
public void TentForTreeOneTreeTwoAdjacentTent() throws InvalidFileFormatException {
From 4d97969ac7b889701d02f5ac5664874ddfb29864 Mon Sep 17 00:00:00 2001
From: Bram van Heuveln <56417002+jadeandtea@users.noreply.github.com>
Date: Tue, 16 Apr 2024 16:45:11 -0400
Subject: [PATCH 27/31] Fix Build Issues
The Ubuntu and Checkstyle Autocompilers have trouble opening this file for some reason
---
.../treetent/rules/FillinRowCaseRule/EmptyRow5x5TwoTent | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRow5x5TwoTent b/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRow5x5TwoTent
index 5a75ca257..ddfcf44db 100644
--- a/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRow5x5TwoTent
+++ b/src/test/resources/puzzles/treetent/rules/FillinRowCaseRule/EmptyRow5x5TwoTent
@@ -1,6 +1,4 @@
-
-