diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
index a55e7a179..f23d52492 100644
--- a/.idea/codeStyles/codeStyleConfig.xml
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -1,5 +1,5 @@
-
+
\ No newline at end of file
diff --git a/bin/main/edu/rpi/legup/log4j2.properties b/bin/main/edu/rpi/legup/log4j2.properties
index de1fa02ed..4f2556c2d 100644
--- a/bin/main/edu/rpi/legup/log4j2.properties
+++ b/bin/main/edu/rpi/legup/log4j2.properties
@@ -1,15 +1,15 @@
-# Logging level
-# Root logger option
-log4j.rootLogger=DEBUG, stdout, file
-# Redirect log messages to console
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
-# Redirect log messages to a log file, support file rolling.
-log4j.appender.file=org.apache.log4j.RollingFileAppender
-log4j.appender.file.File=Legup.log
-log4j.appender.file.MaxFileSize=5MB
-log4j.appender.file.MaxBackupIndex=10
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
+# Logging level
+# Root logger option
+log4j.rootLogger=DEBUG, stdout, file
+# Redirect log messages to console
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.Target=System.out
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
+# Redirect log messages to a log file, support file rolling.
+log4j.appender.file=org.apache.log4j.RollingFileAppender
+log4j.appender.file.File=Legup.log
+log4j.appender.file.MaxFileSize=5MB
+log4j.appender.file.MaxBackupIndex=10
+log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
\ No newline at end of file
diff --git a/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java b/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java
index b32ce23ce..7e8b5eb83 100644
--- a/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java
+++ b/src/test/java/puzzles/nurikabe/rules/BlackBetweenRegionsDirectRuleTest.java
@@ -30,6 +30,9 @@ public static void setUp() {
nurikabe = new Nurikabe();
}
+ /**
+ * Tests the Black Between Regions direct rule for regions that are diagonal to each other (diagonal going from top left to bottom right)
+ */
@Test
public void BlackBetweenRegionsDirectRule_DiagonalBlackBetweenRegions1Test() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/DiagonalBlackBetweenRegions1", nurikabe);
@@ -62,6 +65,9 @@ public void BlackBetweenRegionsDirectRule_DiagonalBlackBetweenRegions1Test() thr
}
}
+ /**
+ * Tests the Black Between Regions direct rule for regions that are diagonal to each other (diagonal going from bottom left to top right)
+ */
@Test
public void BlackBetweenRegionsDirectRule_DiagonalBlackBetweenRegions2Test() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/DiagonalBlackBetweenRegions2", nurikabe);
@@ -94,6 +100,9 @@ public void BlackBetweenRegionsDirectRule_DiagonalBlackBetweenRegions2Test() thr
}
}
+ /**
+ * Tests the Black Between Regions direct rule for regions that are horizontally opposite each other
+ */
@Test
public void BlackBetweenRegionsDirectRule_HorizontalBlackBetweenRegionsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/HorizontalBlackBetweenRegions", nurikabe);
@@ -123,6 +132,9 @@ public void BlackBetweenRegionsDirectRule_HorizontalBlackBetweenRegionsTest() th
}
}
+ /**
+ * Tests the Black Between Regions direct rule for regions that are vertically opposite each other
+ */
@Test
public void BlackBetweenRegionsDirectRule_VerticalBlackBetweenRegionsTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/VerticalBlackBetweenRegions", nurikabe);
@@ -151,4 +163,28 @@ public void BlackBetweenRegionsDirectRule_VerticalBlackBetweenRegionsTest() thro
}
}
}
+
+ /**
+ * Tests the Black Between Regions direct rule for a false application of the rule, where a black tile is enclosed by one region
+ */
+ @Test
+ public void BlackBetweenRegionsDirectRule_FalseBlackBetweenRegionsTest() throws InvalidFileFormatException{
+ TestUtilities.importTestBoard("puzzles/nurikabe/rules/BlackBetweenRegionsDirectRule/FalseBlackBetweenRegions",nurikabe);
+ TreeNode rootNode = nurikabe.getTree().getRootNode();
+ TreeTransition transition = rootNode.getChildren().get(0);
+ transition.setRule(RULE);
+
+ NurikabeBoard board = (NurikabeBoard) transition.getBoard();
+ NurikabeCell cell = board.getCell(1,1);
+ cell.setData(NurikabeType.BLACK.toValue());
+ board.addModifiedData(cell);
+
+ Assert.assertNotNull(RULE.checkRule(transition));
+
+ for(int i=0; i cases = RULE.getCases(board,cell);
+
+ Assert.assertEquals(2,cases.size());
+
+ NurikabeBoard caseBoard = (NurikabeBoard) cases.get(0);
+ NurikabeBoard caseBoard2 = (NurikabeBoard) cases.get(1);
+
+ NurikabeType board1Type = caseBoard.getCell(0,0).getType();
+ NurikabeType board2Type = caseBoard2.getCell(0,0).getType();
+
+ Assert.assertTrue((board1Type.equals(NurikabeType.BLACK) || board1Type.equals(NurikabeType.WHITE)) &&
+ (board2Type.equals(NurikabeType.BLACK) || board2Type.equals(NurikabeType.WHITE)));
+ Assert.assertFalse(board1Type.equals(board2Type));
+
+ Assert.assertEquals(caseBoard.getHeight(),caseBoard2.getHeight(), board.getHeight());
+ Assert.assertEquals(caseBoard.getWidth(),caseBoard2.getWidth(), board.getWidth());
+
+ for(int i=0; i
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/CornerBottleNeck b/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/CornerBottleNeck
new file mode 100644
index 000000000..77f38d5d4
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/CornerBottleNeck
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/FalseBottleNeck b/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/FalseBottleNeck
new file mode 100644
index 000000000..3e3d7610a
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/BlackBottleNeckDirectRule/FalseBottleNeck
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackOrWhiteCaseRule/SimpleBlackOrWhite b/src/test/resources/puzzles/nurikabe/rules/BlackOrWhiteCaseRule/SimpleBlackOrWhite
new file mode 100644
index 000000000..fb5e45218
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/BlackOrWhiteCaseRule/SimpleBlackOrWhite
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/CornerBlackSquare b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/CornerBlackSquare
new file mode 100644
index 000000000..98a01d8b5
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/CornerBlackSquare
@@ -0,0 +1,12 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare
new file mode 100644
index 000000000..813114443
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/BlackSquareContradictionRule/FalseBlackSquare
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/AllCellsReachable b/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/AllCellsReachable
new file mode 100644
index 000000000..63e38d25f
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/AllCellsReachable
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/SimpleUnreachableCell b/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/SimpleUnreachableCell
new file mode 100644
index 000000000..e11487564
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/CannotReachCellDirectRule/SimpleUnreachableCell
@@ -0,0 +1,9 @@
+
+
+
+
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack b/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack
new file mode 100644
index 000000000..0599fdfa4
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/CornerBlackDirectRule/FalseCornerBlack
@@ -0,0 +1,12 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack1 b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack1
new file mode 100644
index 000000000..ae078229e
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack1
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack2 b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack2
new file mode 100644
index 000000000..f274fc774
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/CornerBlack2
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack
new file mode 100644
index 000000000..731e2dc74
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinBlackDirectRule/FalseFillinBlack
@@ -0,0 +1,12 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite1 b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite1
new file mode 100644
index 000000000..de0ca4f71
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite1
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite2 b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite2
new file mode 100644
index 000000000..9fc228483
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/CornerWhite2
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite
new file mode 100644
index 000000000..f2599c71f
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/FillinWhiteDirectRule/FalseFillinWhite
@@ -0,0 +1,12 @@
+
+
+
+
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/DiagonalIsolateBlack b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/DiagonalIsolateBlack
new file mode 100644
index 000000000..7ff5dcf24
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/DiagonalIsolateBlack
@@ -0,0 +1,15 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack
new file mode 100644
index 000000000..b4eb09302
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/IsolateBlackContradictionRule/FalseIsolateBlack
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/ComplexRegion b/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/ComplexRegion
new file mode 100644
index 000000000..5f8e607fe
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/ComplexRegion
@@ -0,0 +1,19 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/FalseContradiction b/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/FalseContradiction
new file mode 100644
index 000000000..0f14d6916
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/MultipleNumbersContradictionRule/FalseContradiction
@@ -0,0 +1,16 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberReachable b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber
similarity index 100%
rename from src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberReachable
rename to src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber
diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2 b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2
new file mode 100644
index 000000000..be1fc64f7
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/FalseNoNumber2
@@ -0,0 +1,18 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberSurroundBlack b/src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/SimpleNoNumber
similarity index 100%
rename from src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/NoNumberSurroundBlack
rename to src/test/resources/puzzles/nurikabe/rules/NoNumberContradictionRule/SimpleNoNumber
diff --git a/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare b/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare
new file mode 100644
index 000000000..2fd8e7d35
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/PreventBlackSquareDirectRule/FalseBlackSquare
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion b/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion
new file mode 100644
index 000000000..5e0b04f68
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/SurroundRegionDirectRule/FalseSurroundRegion
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces
new file mode 100644
index 000000000..ca3e9be84
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/FalseTooFewSpaces
@@ -0,0 +1,17 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/InsufficientSpace b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/InsufficientSpace
new file mode 100644
index 000000000..22163947a
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/TooFewSpacesContradictionRule/InsufficientSpace
@@ -0,0 +1,17 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/ExtraDiagonalSpace b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/ExtraDiagonalSpace
new file mode 100644
index 000000000..5d9ad70e1
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/ExtraDiagonalSpace
@@ -0,0 +1,14 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion
new file mode 100644
index 000000000..3ec126199
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/TooManySpacesContradictionRule/MultipleNumberRegion
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/AllCellsReachable b/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/AllCellsReachable
new file mode 100644
index 000000000..dbc5fadb2
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/AllCellsReachable
@@ -0,0 +1,13 @@
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/SimpleUnreachableTest b/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/SimpleUnreachableTest
new file mode 100644
index 000000000..3d456bdb0
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/UnreachableWhiteCellContradictionRule/SimpleUnreachableTest
@@ -0,0 +1,10 @@
+
+
+
+
+ |
+ |
+
+
+
+
\ No newline at end of file
diff --git a/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck b/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck
new file mode 100644
index 000000000..521576aeb
--- /dev/null
+++ b/src/test/resources/puzzles/nurikabe/rules/WhiteBottleNeckDirectRule/FalseBottleNeck
@@ -0,0 +1,11 @@
+
+
+
+
+ |
+ |
+ |
+
+
+
+
\ No newline at end of file