diff --git a/build.gradle b/build.gradle
index fafa54cac..1ba7ea006 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,7 +17,6 @@ dependencies {
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'org.jetbrains:annotations:20.1.0'
implementation 'com.formdev:flatlaf:3.0'
- implementation project(':legup-update')
implementation 'com.google.firebase:firebase-admin:6.3.0'
implementation 'org.apache.httpcomponents:httpclient:4.5.1'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
diff --git a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/BlockInVerticalPath b/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/BlockInVerticalPath
deleted file mode 100644
index 5f27b3ec8..000000000
--- a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/BlockInVerticalPath
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/CannotFillMiddle b/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/CannotFillMiddle
deleted file mode 100644
index e69de29bb..000000000
diff --git a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInHorizontalPath b/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInHorizontalPath
deleted file mode 100644
index 633ccc80b..000000000
--- a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInHorizontalPath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInVerticalPath b/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInVerticalPath
deleted file mode 100644
index 70419c40c..000000000
--- a/build/resources/test/puzzles/lightup/rules/BulbsInPathContradictionRule/LightInVerticalPath
+++ /dev/null
@@ -1,10 +0,0 @@
-
-
-
-
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillCorners b/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillCorners
deleted file mode 100644
index 38b52f04d..000000000
--- a/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillCorners
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillMiddle b/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillMiddle
deleted file mode 100644
index 44086f145..000000000
--- a/build/resources/test/puzzles/lightup/rules/CannotLightACellContradictionRule/CannotFillMiddle
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/BlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/BlockEnclosed
deleted file mode 100644
index a57a2473e..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/BlockEnclosed
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CompleteBoardBlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CompleteBoardBlockEnclosed
deleted file mode 100644
index f48d240f0..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CompleteBoardBlockEnclosed
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CornerBlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CornerBlockEnclosed
deleted file mode 100644
index 1a9cd60d9..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/CornerBlockEnclosed
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/ManyBlocksEnclosed b/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/ManyBlocksEnclosed
deleted file mode 100644
index 32200d831..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooFewBulbsContradictionRule/ManyBlocksEnclosed
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/BlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/BlockEnclosed
deleted file mode 100644
index c5760aede..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/BlockEnclosed
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CompleteBoardBlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CompleteBoardBlockEnclosed
deleted file mode 100644
index 88fb0a8f1..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CompleteBoardBlockEnclosed
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CornerBlockEnclosed b/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CornerBlockEnclosed
deleted file mode 100644
index a9a8dc5a0..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/CornerBlockEnclosed
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/ManyBlocksEnclosed b/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/ManyBlocksEnclosed
deleted file mode 100644
index e743862eb..000000000
--- a/build/resources/test/puzzles/lightup/rules/TooManyBulbsContradictionRule/ManyBlocksEnclosed
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
-
-
- |
- |
- |
- |
- |
- |
- |
- |
- |
-
-
-
-
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 936e82b6f..f9f593d2b 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,2 @@
rootProject.name = 'Legup'
-include ':legup'
-include ':legup-update'
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixExporter.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixExporter.java
index 2fa8fb64c..757d14cd8 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixExporter.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixExporter.java
@@ -2,6 +2,7 @@
import edu.rpi.legup.model.PuzzleExporter;
import edu.rpi.legup.model.gameboard.PuzzleElement;
+import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard;
import org.w3c.dom.Document;
public class FillapixExporter extends PuzzleExporter {
@@ -15,7 +16,7 @@ protected org.w3c.dom.Element createBoardElement(Document newDocument) {
FillapixBoard board;
if (puzzle.getTree() != null) {
board = (FillapixBoard) puzzle.getTree().getRootNode().getBoard();
- }
+ }
else {
board = (FillapixBoard) puzzle.getBoardView().getBoard();
}
diff --git a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixUtilities.java b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixUtilities.java
index 0df99b820..a7feac91d 100644
--- a/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixUtilities.java
+++ b/src/main/java/edu/rpi/legup/puzzle/fillapix/FillapixUtilities.java
@@ -154,7 +154,7 @@ public static ArrayList getCellsAtDistance(FillapixBoard board, Fi
*
* @return an ArrayList of Boolean arrays. Each index in the ArrayList represents
* a distinct combination. Each Boolean array will be totalNumItems
- * long and each index will be true<\code> if the corresponding item is
+ * long and each index will be true
if the corresponding item is
* included in that combination, and false
otherwise.
*/
public static ArrayList getCombinations(int chosenNumItems, int totalNumItems) {
diff --git a/src/test/java/puzzles/shorttruthtable/rules/AtomicDirectRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AtomicDirectRuleTest.java
new file mode 100644
index 000000000..51aa213c6
--- /dev/null
+++ b/src/test/java/puzzles/shorttruthtable/rules/AtomicDirectRuleTest.java
@@ -0,0 +1,188 @@
+package puzzles.shorttruthtable.rules;
+
+import edu.rpi.legup.model.tree.TreeNode;
+import edu.rpi.legup.model.tree.TreeTransition;
+import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable;
+import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard;
+import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell;
+import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType;
+import edu.rpi.legup.puzzle.shorttruthtable.rules.basic.DirectRuleAtomic;
+import edu.rpi.legup.save.InvalidFileFormatException;
+import legup.MockGameBoardFacade;
+import legup.TestUtilities;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class AtomicDirectRuleTest {
+ private static final DirectRuleAtomic RULE = new DirectRuleAtomic();
+ private static ShortTruthTable stt;
+
+ @BeforeClass
+ public static void setup() {
+ MockGameBoardFacade.getInstance();
+ stt = new ShortTruthTable();
+ }
+
+ /**
+ * Given two statements:
+ * A
+ * A
+ * where the first A is set to false.
+ *
+ * This test sets the second A to false and then asserts that this
+ * is a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void MatchingFalseTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/FalseA", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.FALSE);
+ board.addModifiedData(cell);
+
+ Assert.assertNull(RULE.checkRule(transition));
+ }
+
+ /**
+ * Given two statements:
+ * A
+ * A
+ * where the first A is set to false.
+ *
+ * This test sets the second A to true and then asserts that this
+ * is not a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void MismatchingFalseTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/FalseA", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.TRUE);
+ board.addModifiedData(cell);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
+
+ /**
+ * Given two statements:
+ * B
+ * B
+ * where the first B is set to true.
+ *
+ * This test sets the second B to true and then asserts that this
+ * is a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void MatchingTrueTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/TrueB", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.TRUE);
+ board.addModifiedData(cell);
+
+ Assert.assertNull(RULE.checkRule(transition));
+ }
+
+ /**
+ * Given two statements:
+ * B
+ * B
+ * where the first B is set to true.
+ *
+ * This test sets the second B to false and then asserts that this
+ * is not a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void MismatchingTrueTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/TrueB", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.FALSE);
+ board.addModifiedData(cell);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
+
+ /**
+ * Given two statements:
+ * C
+ * C
+ * where neither statement is set to anything.
+ *
+ * This test sets the second C to false and then asserts that this
+ * is not a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void NothingPreviouslyMarkedTest() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/Empty", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.FALSE);
+ board.addModifiedData(cell);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
+
+ /**
+ * Given two statements:
+ * C
+ * C
+ * where neither statement is set to anything.
+ *
+ * This test sets the second C to true and then asserts that this
+ * is not a valid application of the rule.
+ *
+ * @throws InvalidFileFormatException
+ */
+ @Test
+ public void NothingPreviouslyMarkedTest2() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/shorttruthtable/rules/AtomicDirectRule/Empty", stt);
+ TreeNode rootNode = stt.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard();
+
+ ShortTruthTableCell cell = board.getCell(0, 2);
+ cell.setData(ShortTruthTableCellType.TRUE);
+ board.addModifiedData(cell);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/puzzles/shorttruthtable/rules/DirectRuleAtomicTest.java b/src/test/java/puzzles/shorttruthtable/rules/DirectRuleAtomicTest.java
deleted file mode 100644
index 81991fa46..000000000
--- a/src/test/java/puzzles/shorttruthtable/rules/DirectRuleAtomicTest.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package puzzles.shorttruthtable.rules;
-
-class DirectRuleAtomicTest {
-
-
-}
\ No newline at end of file
diff --git a/src/test/java/puzzles/treetent/rules/NoTentForTreeContradictionRuleTest.java b/src/test/java/puzzles/treetent/rules/NoTentForTreeContradictionRuleTest.java
index b2d47e222..52aea28c0 100644
--- a/src/test/java/puzzles/treetent/rules/NoTentForTreeContradictionRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/NoTentForTreeContradictionRuleTest.java
@@ -28,8 +28,12 @@ public static void setUp() {
treetent = new TreeTent();
}
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if a tree is next to only grass in a 2x2 grid triggers the contradiction
+ */
@Test
- public void NoTentForTreeContradictionRule_() throws InvalidFileFormatException {
+ public void NoTentForTreeContradictionRule_Basic() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTree", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
@@ -43,5 +47,65 @@ public void NoTentForTreeContradictionRule_() throws InvalidFileFormatException
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
}
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests similarly to above, but now with a tent diagonally next to the tree, which should still contradict
+ */
+ @Test
+ public void NoTentForTreeContradictionRule_Diagonal() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeDiagonal", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests that adjacent trees do not allow a pass
+ */
+ @Test
+ public void NoTentForTreeContradictionRule_TwoTrees() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTrees", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests similarly to above, but now with a tent diagonally next to two trees, which should still contradict on one.
+ */
+ @Test
+ public void NoTentForTreeContradictionRule_TwoTreesDiagonal() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTreesDiagonal", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
}
diff --git a/src/test/java/puzzles/treetent/rules/NoTreeForTentContradictionRuleTest.java b/src/test/java/puzzles/treetent/rules/NoTreeForTentContradictionRuleTest.java
index c3003cef1..2ad2ac90e 100644
--- a/src/test/java/puzzles/treetent/rules/NoTreeForTentContradictionRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/NoTreeForTentContradictionRuleTest.java
@@ -10,13 +10,9 @@
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.TreeTentType;
import edu.rpi.legup.puzzle.treetent.rules.NoTreeForTentContradictionRule;
import edu.rpi.legup.save.InvalidFileFormatException;
-import java.awt.*;
-
public class NoTreeForTentContradictionRuleTest {
private static final NoTreeForTentContradictionRule RULE = new NoTreeForTentContradictionRule();
@@ -28,9 +24,13 @@ public static void setUp() {
treetent = new TreeTent();
}
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 2x2 Grid, a Tent in the NW corner has no adjacent trees
+ */
@Test
- public void NoTreeForTentContradictionRule_() throws InvalidFileFormatException {
- TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent", treetent);
+ public void NoTreeForTentContradictionRule_NW() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNW", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
@@ -43,5 +43,165 @@ public void NoTreeForTentContradictionRule_() throws InvalidFileFormatException
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
}
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 2x2 Grid, a Tent in the NE corner has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_NE() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNE", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 2x2 Grid, a Tent in the NW corner has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_SW() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSW", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 2x2 Grid, a Tent in the SE corner has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_SE() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSE", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 3x3 Grid with no trees, a Tent in the center cell has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_3x3() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent3x3", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 2)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 3x3 Grid with diagonal trees, a Tent in the center cell has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_3x3WithDiagonalTrees() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentDiagonals", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 2)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 3x3 Grid with an adjacent tree, test does not assert null.
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_YesTree() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentYesTree", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNotNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 2)));
+ }
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if, in a 3x3 Grid with touching tents, a Tent in the center cell has no adjacent trees
+ */
+ @Test
+ public void NoTreeForTentContradictionRule_JustTent() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentJustTent", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 2)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(2, 2)));
+ }
}
diff --git a/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java b/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
index 14afb4dc0..999405747 100644
--- a/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/SurroundTentWithGrassDirectRuleTest.java
@@ -27,6 +27,10 @@ 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 {
TestUtilities.importTestBoard("puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrass", treetent);
@@ -58,6 +62,90 @@ 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 {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassBad", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ TreeTentCell cell1 = board.getCell(0, 0);
+ cell1.setData(TreeTentType.GRASS);
+ TreeTentCell cell2 = board.getCell(1, 0);
+ cell2.setData(TreeTentType.GRASS);
+ TreeTentCell cell3 = board.getCell(2, 0);
+ cell3.setData(TreeTentType.GRASS);
+ TreeTentCell cell4 = board.getCell(0, 1);
+ cell4.setData(TreeTentType.GRASS);
+ //Skip (1,1) due to being the Tent
+ TreeTentCell cell5 = board.getCell(2, 1);
+ cell5.setData(TreeTentType.GRASS);
+ TreeTentCell cell6 = board.getCell(0, 2);
+ cell6.setData(TreeTentType.GRASS);
+ TreeTentCell cell7 = board.getCell(1, 2);
+ cell7.setData(TreeTentType.GRASS);
+ TreeTentCell cell8 = board.getCell(2, 2);
+ cell8.setData(TreeTentType.GRASS);
+
+ board.addModifiedData(cell1);
+ board.addModifiedData(cell2);
+ board.addModifiedData(cell3);
+ //board.addModifiedData(cell4);
+ board.addModifiedData(cell5);
+ board.addModifiedData(cell6);
+ board.addModifiedData(cell7);
+ board.addModifiedData(cell8);
+
+ Assert.assertNull(RULE.checkRule(transition));
+
+ for (int i = 0; i < board.getHeight(); i++) {
+ for (int k = 0; k < board.getWidth(); k++) {
+ Point point = new Point(k, i);
+ if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation()) ||
+ point.equals(cell3.getLocation()) || //point.equals(cell4.getLocation()) ||
+ point.equals(cell5.getLocation()) || point.equals(cell6.getLocation()) ||
+ point.equals(cell7.getLocation()) || point.equals(cell8.getLocation())
+ ) {
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i)));
+ }
+ else {
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i)));
+ }
+ }
+ }
+ }
+
+ /**
+ * @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{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassTrees", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkRule(transition));
+
+ for (int i = 0; i < board.getHeight(); i++){
+ for (int k = 0; k < board.getWidth(); k++){
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i)));
+ }
+ }
+ }
}
diff --git a/src/test/java/puzzles/treetent/rules/TouchingTentsContradictionRuleTest.java b/src/test/java/puzzles/treetent/rules/TouchingTentsContradictionRuleTest.java
index 79fc70118..f48afe5d7 100644
--- a/src/test/java/puzzles/treetent/rules/TouchingTentsContradictionRuleTest.java
+++ b/src/test/java/puzzles/treetent/rules/TouchingTentsContradictionRuleTest.java
@@ -10,13 +10,9 @@
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.TreeTentType;
import edu.rpi.legup.puzzle.treetent.rules.TouchingTentsContradictionRule;
import edu.rpi.legup.save.InvalidFileFormatException;
-import java.awt.*;
-
public class TouchingTentsContradictionRuleTest {
private static final TouchingTentsContradictionRule RULE = new TouchingTentsContradictionRule();
@@ -28,8 +24,14 @@ public static void setUp() {
treetent = new TreeTent();
}
+ //DIAGONAL TESTS
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent diagonal of orientation T
+ * T
+ **/
@Test
- public void TouchingTentsContradictionRule_Diagonal() throws InvalidFileFormatException {
+ public void TouchingTentsContradictionRule_DiagonalUpLeftToDownRight() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsDiagonal", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
@@ -44,8 +46,35 @@ public void TouchingTentsContradictionRule_Diagonal() throws InvalidFileFormatEx
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
}
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent diagonal of orientation T
+ * T
+ **/
@Test
- public void TouchingTentsContradictionRule_Adjacent() throws InvalidFileFormatException {
+ public void TouchingTentsContradictionRule_DiagonalDownLeftToUpRight() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsDiagonalAlt",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition,board.getCell(1,0)));
+ Assert.assertNull(RULE.checkRuleAt(transition,board.getCell(0,1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+
+ //ADJACENT TESTS
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent adjacent of orientation T
+ * T
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_AdjacentVertical() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsAdjacent", treetent);
TreeNode rootNode = treetent.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
@@ -59,6 +88,162 @@ public void TouchingTentsContradictionRule_Adjacent() throws InvalidFileFormatEx
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
}
+
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent adjacent of orientation TT
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_AdjacentHorizontal() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsAdjacentAlt", treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+ //MIXED TESTS
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent of orientation TT
+ * TT
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_2By2Square() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsFull2By2",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent of orientation TT
+ * T
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_UpLeft() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpLeft",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent of orientation TT
+ * T
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_UpRight() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpRight",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent of orientation T
+ * TT
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_DownLeft() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownLeft",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests a tent of orientation T
+ * TT
+ **/
+ @Test
+ public void TouchingTentsContradictionRule_DownRight() throws InvalidFileFormatException {
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownRight",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNull(RULE.checkContradiction(board));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(1, 1)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if tree adjacent triggers a null
+ */
+ @Test
+ public void TouchingTentsContradictionRule_TreeAdjacent() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeAdjacent",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNotNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 1)));
+ }
+ /**
+ * @throws InvalidFileFormatException
+ * Tests if tree diagonal triggers a null
+ */
+ @Test
+ public void TouchingTentsContradictionRule_TreeDiagonal() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeDiagonal",treetent);
+ TreeNode rootNode = treetent.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ TreeTentBoard board = (TreeTentBoard) transition.getBoard();
+
+ Assert.assertNotNull(RULE.checkContradiction(board));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(0, 0)));
+ Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(1, 0)));
+ }
+
}
diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/Empty b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/Empty
new file mode 100644
index 000000000..6a6effadf
--- /dev/null
+++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/Empty
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/FalseA b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/FalseA
new file mode 100644
index 000000000..8c5ddc7b9
--- /dev/null
+++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/FalseA
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/TrueB b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/TrueB
new file mode 100644
index 000000000..46a1beb2d
--- /dev/null
+++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicDirectRule/TrueB
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ |
+
+
+
+
+
diff --git a/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeDiagonal b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeDiagonal
new file mode 100644
index 000000000..af0b49e31
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeDiagonal
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTrees b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTrees
new file mode 100644
index 000000000..5111e0585
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTrees
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTreesDiagonal b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTreesDiagonal
new file mode 100644
index 000000000..10391b85c
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTentForTreeContradictionRule/NoTentForTreeTwoTreesDiagonal
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent3x3 b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent3x3
new file mode 100644
index 000000000..9c5e81936
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent3x3
@@ -0,0 +1,28 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentDiagonals b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentDiagonals
new file mode 100644
index 000000000..ad086bbc1
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentDiagonals
@@ -0,0 +1,28 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentJustTent b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentJustTent
new file mode 100644
index 000000000..93aaf451f
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentJustTent
@@ -0,0 +1,28 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNE b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNE
new file mode 100644
index 000000000..80ffb9525
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNE
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNW
similarity index 100%
rename from src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTent
rename to src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentNW
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSE b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSE
new file mode 100644
index 000000000..c2fc5206d
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSE
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSW b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSW
new file mode 100644
index 000000000..8e8249b27
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentSW
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentYesTree b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentYesTree
new file mode 100644
index 000000000..f46e4b5a5
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/NoTreeForTentContradictionRule/NoTreeForTentYesTree
@@ -0,0 +1,28 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassBad b/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassBad
new file mode 100644
index 000000000..6065d42cd
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassBad
@@ -0,0 +1,20 @@
+
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassTrees b/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassTrees
new file mode 100644
index 000000000..e8fef64dc
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/SurroundTentWithGrassDirectRule/SurroundTentWithGrassTrees
@@ -0,0 +1,28 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsAdjacentAlt b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsAdjacentAlt
new file mode 100644
index 000000000..902fb3ee7
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsAdjacentAlt
@@ -0,0 +1,19 @@
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsDiagonalAlt b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsDiagonalAlt
new file mode 100644
index 000000000..9b35fb998
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsDiagonalAlt
@@ -0,0 +1,19 @@
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsFull2By2 b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsFull2By2
new file mode 100644
index 000000000..59805ca35
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsFull2By2
@@ -0,0 +1,21 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownLeft b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownLeft
new file mode 100644
index 000000000..af4ca0831
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownLeft
@@ -0,0 +1,20 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownRight b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownRight
new file mode 100644
index 000000000..05b7a7667
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedDownRight
@@ -0,0 +1,20 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpLeft b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpLeft
new file mode 100644
index 000000000..b8b81c7b4
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpLeft
@@ -0,0 +1,20 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpRight b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpRight
new file mode 100644
index 000000000..af7fb5df2
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsMixedUpRight
@@ -0,0 +1,20 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeAdjacent b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeAdjacent
new file mode 100644
index 000000000..4c63558c2
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeAdjacent
@@ -0,0 +1,19 @@
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeDiagonal b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeDiagonal
new file mode 100644
index 000000000..b2f54aef3
--- /dev/null
+++ b/src/test/resources/puzzles/treetent/rules/TouchingTentsContradictionRule/TouchingTentsTreeDiagonal
@@ -0,0 +1,19 @@
+
+
+
+
+ |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file