diff --git a/src/main/java/edu/rpi/legup/puzzle/minesweeper/MinesweeperElementView.java b/src/main/java/edu/rpi/legup/puzzle/minesweeper/MinesweeperElementView.java index a897d4eae..d977045b7 100644 --- a/src/main/java/edu/rpi/legup/puzzle/minesweeper/MinesweeperElementView.java +++ b/src/main/java/edu/rpi/legup/puzzle/minesweeper/MinesweeperElementView.java @@ -35,7 +35,7 @@ public void drawElement(@NotNull Graphics2D graphics2D) { int intValue = ((MinesweeperCell) puzzleElement).getData().data(); final String value = String.valueOf(intValue); - if(intValue== 1) { + if(intValue == 1) { Color MSBLUE = new Color(7,3,251); graphics2D.setColor(MSBLUE); } else if(intValue == 2) { diff --git a/src/main/java/edu/rpi/legup/puzzle/minesweeper/rules/MineOrEmptyCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/minesweeper/rules/MineOrEmptyCaseRule.java index 4724d2be2..66278e750 100644 --- a/src/main/java/edu/rpi/legup/puzzle/minesweeper/rules/MineOrEmptyCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/minesweeper/rules/MineOrEmptyCaseRule.java @@ -17,7 +17,7 @@ public MineOrEmptyCaseRule() { super( "MINE-CASE-0001", "Mine or Empty", - "An unset cell can either be a mine or filled.", + "An unset cell can either be a mine or empty.", "edu/rpi/legup/images/minesweeper/cases/MineOrEmpty.png"); } diff --git a/src/test/java/puzzles/minesweeper/FinishWithEmptyDirectRuleTest.java b/src/test/java/puzzles/minesweeper/FinishWithEmptyDirectRuleTest.java index 0469bfc71..6316907f1 100644 --- a/src/test/java/puzzles/minesweeper/FinishWithEmptyDirectRuleTest.java +++ b/src/test/java/puzzles/minesweeper/FinishWithEmptyDirectRuleTest.java @@ -27,8 +27,10 @@ public static void setUp() { minesweeper = new Minesweeper(); } + // tests the finish with empty direct rule is many different cases + @Test - public void FinishWithEmptyDirectRule_OneUnsetOneEmptyOneClueTest1() + public void FinishWithEmptyDirectRule_OneUnsetOneEmptyOneNumberTest1() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test8.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -58,7 +60,7 @@ public void FinishWithEmptyDirectRule_OneUnsetOneEmptyOneClueTest1() } @Test - public void FinishWithEmptyDirectRule_FiveUnsetOneEmptyOneClueTest2() + public void FinishWithEmptyDirectRule_FiveUnsetOneEmptyOneNumberTest2() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test9.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -88,7 +90,7 @@ public void FinishWithEmptyDirectRule_FiveUnsetOneEmptyOneClueTest2() } @Test - public void FinishWithEmptyDirectRule_NineUnsetOneEmptyZeroCluesTest3() + public void FinishWithEmptyDirectRule_NineUnsetOneEmptyZeroNumbersTest3() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -118,7 +120,7 @@ public void FinishWithEmptyDirectRule_NineUnsetOneEmptyZeroCluesTest3() } @Test - public void FinishWithEmptyDirectRule_NineUnsetNineEmptyZeroCluesTest4() + public void FinishWithEmptyDirectRule_NineUnsetNineEmptyZeroNumbersTest4() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -176,7 +178,7 @@ public void FinishWithEmptyDirectRule_NineUnsetNineEmptyZeroCluesTest4() } @Test - public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeCluesTest5() + public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeNumbersTest5() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test10.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -206,7 +208,7 @@ public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeCluesTest5() } @Test - public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeCluesTest6() + public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeNumbersTest6() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test11.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -236,7 +238,7 @@ public void FinishWithEmptyDirectRule_OneUnsetOneEmptyThreeCluesTest6() } @Test - public void FinishWithEmptyDirectRule_FiveUnsetTwoEmptyTwoCluesTest7() + public void FinishWithEmptyDirectRule_FiveUnsetTwoEmptyTwoNumbersTest7() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test12.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); diff --git a/src/test/java/puzzles/minesweeper/FinishWithMinesDirectRuleTest.java b/src/test/java/puzzles/minesweeper/FinishWithMinesDirectRuleTest.java index cce25dcc2..efa77e0a9 100644 --- a/src/test/java/puzzles/minesweeper/FinishWithMinesDirectRuleTest.java +++ b/src/test/java/puzzles/minesweeper/FinishWithMinesDirectRuleTest.java @@ -24,8 +24,10 @@ public static void setUp() { minesweeper = new Minesweeper(); } + // tests the finish with mines direct rule is many different cases + @Test - public void FinishWithMinesDirectRule_OneUnsetOneBombOneClueTest1() + public void FinishWithMinesDirectRule_OneUnsetOneBombOneNumberTest1() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test2.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -55,7 +57,7 @@ public void FinishWithMinesDirectRule_OneUnsetOneBombOneClueTest1() } @Test - public void FinishWithMinesDirectRule_FourUnsetOneBombOneClueTest2() + public void FinishWithMinesDirectRule_FourUnsetOneBombOneNumberTest2() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test3.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -86,7 +88,7 @@ public void FinishWithMinesDirectRule_FourUnsetOneBombOneClueTest2() @Test - public void FinishWithMinesDirectRule_FourUnsetFourBombsOneClueTest3() + public void FinishWithMinesDirectRule_FourUnsetFourBombsOneNumberTest3() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test3.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -126,7 +128,7 @@ public void FinishWithMinesDirectRule_FourUnsetFourBombsOneClueTest3() } @Test - public void FinishWithMinesDirectRule_EightUnsetEightBombsOneClueTest4() + public void FinishWithMinesDirectRule_EightUnsetEightBombsOneNumberTest4() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test4.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -180,7 +182,7 @@ public void FinishWithMinesDirectRule_EightUnsetEightBombsOneClueTest4() } @Test - public void FinishWithMinesDirectRule_OneUnsetOneBombFourCluesTest5() + public void FinishWithMinesDirectRule_OneUnsetOneBombFourNumbersTest5() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test5.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -210,7 +212,7 @@ public void FinishWithMinesDirectRule_OneUnsetOneBombFourCluesTest5() } @Test - public void FinishWithMinesDirectRule_TwoUnsetTwoBombsTwoCluesTest6() + public void FinishWithMinesDirectRule_TwoUnsetTwoBombsTwoNumbersTest6() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test6.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); @@ -243,7 +245,7 @@ public void FinishWithMinesDirectRule_TwoUnsetTwoBombsTwoCluesTest6() } @Test - public void FinishWithMinesDirectRule_ThreeUnsetOneBombTwoCluesTest7() + public void FinishWithMinesDirectRule_ThreeUnsetOneBombTwoNumbersTest7() throws InvalidFileFormatException { TestUtilities.importTestBoard("puzzles/minesweeper/rules/3x3test7.txt", minesweeper); TreeNode rootNode = minesweeper.getTree().getRootNode(); diff --git a/src/test/java/puzzles/minesweeper/MineOrEmptyCaseRuleTest.java b/src/test/java/puzzles/minesweeper/MineOrEmptyCaseRuleTest.java index 26cd7961a..c478ded29 100644 --- a/src/test/java/puzzles/minesweeper/MineOrEmptyCaseRuleTest.java +++ b/src/test/java/puzzles/minesweeper/MineOrEmptyCaseRuleTest.java @@ -31,7 +31,7 @@ public static void setUp() { /** * Tests the Mine or Empty case rule by ensuring that it results in two children, that contain - * a modified cell that is either black or white + * a modified cell that is either mine or empty */ @Test public void MineOrEmptyCaseRuleTest1() diff --git a/src/test/java/puzzles/minesweeper/NonTouchingSharedEmptyDirectRuleTest.java b/src/test/java/puzzles/minesweeper/NonTouchingSharedEmptyDirectRuleTest.java index e7bdb11c6..19b06f52b 100644 --- a/src/test/java/puzzles/minesweeper/NonTouchingSharedEmptyDirectRuleTest.java +++ b/src/test/java/puzzles/minesweeper/NonTouchingSharedEmptyDirectRuleTest.java @@ -27,6 +27,8 @@ public static void setUp() { minesweeper = new Minesweeper(); } + // Horizontal/vertical tests means the adjacent number cells are adjacent horizontally/vertically + @Test public void NonTouchingSharedEmptyDirectRule_HorizontalTest1() throws InvalidFileFormatException { diff --git a/src/test/java/puzzles/minesweeper/NonTouchingSharedMineDirectRuleTest.java b/src/test/java/puzzles/minesweeper/NonTouchingSharedMineDirectRuleTest.java index f44436192..f786e7214 100644 --- a/src/test/java/puzzles/minesweeper/NonTouchingSharedMineDirectRuleTest.java +++ b/src/test/java/puzzles/minesweeper/NonTouchingSharedMineDirectRuleTest.java @@ -27,6 +27,8 @@ public static void setUp() { minesweeper = new Minesweeper(); } + // Horizontal/vertical tests means the adjacent number cells are adjacent horizontally/vertically + @Test public void NonTouchingSharedMineDirectRule_HorizontalTest1() throws InvalidFileFormatException { diff --git a/src/test/java/puzzles/minesweeper/SatisfyNumberCaseRuleTest.java b/src/test/java/puzzles/minesweeper/SatisfyNumberCaseRuleTest.java index 5ab166fa0..cbae2d053 100644 --- a/src/test/java/puzzles/minesweeper/SatisfyNumberCaseRuleTest.java +++ b/src/test/java/puzzles/minesweeper/SatisfyNumberCaseRuleTest.java @@ -32,7 +32,7 @@ public static void setUp() { /** * Tests the Satisfy Number case rule by ensuring that it results in all possibilities * for the number. This case tests a number 2 with three unset cells around it, so each - * case must a different arrangement of two bombs and one empty. + * case must replace the unset tiles with a different arrangement of two bombs and one empty. */ @Test public void SatisfyNumberCaseRuleTest1() diff --git a/src/test/java/puzzles/minesweeper/TooFewMinesContradictionRuleTest.java b/src/test/java/puzzles/minesweeper/TooFewMinesContradictionRuleTest.java index 82cecf8a4..f28d909f4 100644 --- a/src/test/java/puzzles/minesweeper/TooFewMinesContradictionRuleTest.java +++ b/src/test/java/puzzles/minesweeper/TooFewMinesContradictionRuleTest.java @@ -39,6 +39,7 @@ public void TooManyMinesTest1() throws InvalidFileFormatException { Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 1))); + Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 2))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 2))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); @@ -63,6 +64,7 @@ public void TooManyMinesTest2() throws InvalidFileFormatException { Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 1))); + Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 2))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 2))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); diff --git a/src/test/java/puzzles/minesweeper/TooManyMinesContradictionRuleTest.java b/src/test/java/puzzles/minesweeper/TooManyMinesContradictionRuleTest.java index 64f2ad810..c0715f618 100644 --- a/src/test/java/puzzles/minesweeper/TooManyMinesContradictionRuleTest.java +++ b/src/test/java/puzzles/minesweeper/TooManyMinesContradictionRuleTest.java @@ -39,8 +39,9 @@ public void TooManyMinesTest1() throws InvalidFileFormatException { Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 0))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 1))); + Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(0, 2))); Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(1, 2))); - Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 1))); + Assert.assertNotNull(RULE.checkContradictionAt(board, board.getCell(2, 2))); } }