diff --git a/puzzles files/starbattle/10x10 Star Battle 2 star Normal/10x10 Star Battle 2star Normal1.xml b/puzzles files/starbattle/10x10 Star Battle 2 star Normal/10x10 Star Battle 2star Normal1.xml deleted file mode 100644 index aac7dd8f9..000000000 --- a/puzzles files/starbattle/10x10 Star Battle 2 star Normal/10x10 Star Battle 2star Normal1.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 b/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 deleted file mode 100644 index b86e16ff2..000000000 --- a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 visualized (DO NOT OPEN AS A PUZZLE).png b/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 visualized (DO NOT OPEN AS A PUZZLE).png deleted file mode 100644 index 5e42c2033..000000000 Binary files a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050101 visualized (DO NOT OPEN AS A PUZZLE).png and /dev/null differ diff --git a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050102 b/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050102 deleted file mode 100644 index 73d131d69..000000000 --- a/puzzles files/starbattle/5x5 Star Battle 1 star Normal/050102 +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle Normal1 visualized (DO NOT OPEN AS A PUZZLE).png b/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle Normal1 visualized (DO NOT OPEN AS A PUZZLE).png deleted file mode 100644 index 584d08153..000000000 Binary files a/puzzles files/starbattle/6x6 Star Battle 1 star Normal/6x6 Star Battle Normal1 visualized (DO NOT OPEN AS A PUZZLE).png and /dev/null differ diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/StarBattleBoard.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/StarBattleBoard.java index 3b91aee35..5132f33e4 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/StarBattleBoard.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/StarBattleBoard.java @@ -97,25 +97,14 @@ public int rowStars(int rowIndex) { public StarBattleBoard copy() { StarBattleBoard copy = new StarBattleBoard(size, puzzleNum); - for (int r = 0; r < this.regions.size(); ++r) { - StarBattleRegion regionCopy = this.regions.get(r).copy(); - for (StarBattleCell cell: regionCopy.getCells()) { - copy.setCell(cell.getLocation().x, cell.getLocation().y, cell); - } - copy.setRegion(r, regionCopy); - } - /* for (int x = 0; x < this.dimension.width; x++) { for (int y = 0; y < this.dimension.height; y++) { copy.setCell(x, y, getCell(x, y).copy()); } - if (x < this.regions.size()) { copy.regions.add(this.getRegion(x).copy()); } - } - */ for (PuzzleElement e : modifiedData) { copy.getPuzzleElement(e).setModifiable(false); } diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRegionsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRegionsDirectRule.java index 9fdaa23a8..433567460 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRegionsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRegionsDirectRule.java @@ -8,9 +8,8 @@ import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; import edu.rpi.legup.puzzle.starbattle.StarBattleCell; import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import io.opencensus.trace.Link; - -import java.util.*; +import java.util.HashSet; +import java.util.Set; public class ColumnsWithinRegionsDirectRule extends DirectRule { public ColumnsWithinRegionsDirectRule() { @@ -21,25 +20,6 @@ public ColumnsWithinRegionsDirectRule() { "edu/rpi/legup/images/starbattle/rules/ColumnsWithinRegionsDirectRule.png"); } - private void generateSubsets(List> subsets, int current, int skip, int size) { - if (current == size) { - return; - } - List> newSubsets = new LinkedList>(); - if (current != skip) { - for (List subset: subsets) { - List copy = new LinkedList(subset); - copy.add(current); - newSubsets.add(copy); - } - subsets.addAll(newSubsets); - List oneMember = new LinkedList(); - oneMember.add(current); - subsets.add(oneMember); - } - generateSubsets(subsets, current + 1 == skip ? current + 2 : current + 1, skip, size); - } - /** * Checks whether the child node logically follows from the parent node at the specific * puzzleElement index using this rule @@ -51,45 +31,53 @@ private void generateSubsets(List> subsets, int current, int skip, */ @Override public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { - + // assumption: the rule has been applied to its fullest extent and the rows and regions + // are now mutually encompassing StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleBoard origBoard = (StarBattleBoard) transition.getParents().get(0).getBoard(); StarBattleCell cell = (StarBattleCell) board.getPuzzleElement(puzzleElement); - int dim = board.getSize(); - int region = cell.getGroupIndex(); - int column = cell.getLocation().x; - if (cell.getType() != StarBattleCellType.BLACK) { return "Only black cells are allowed for this rule!"; } + // the columns that are contained + Set columns = new HashSet(); + // the regions that contain them + Set regions = new HashSet(); + // columns and regions to process + Set columnsToCheck = new HashSet(); + Set regionsToCheck = new HashSet(); + int columnStars = 0; + int regionStars = 0; + regions.add(cell.getGroupIndex()); + regionsToCheck.add(cell.getGroupIndex()); - List> subsets = new LinkedList>(); - generateSubsets(subsets,0, column, dim); - - for (List columnSubset: subsets) { - Set regions = new HashSet(); - boolean containsRegion = false; - int columnStars = 0; - int regionStars = 0; - for (int c: columnSubset) { - columnStars += origBoard.columnStars(c); - for (StarBattleCell ce: origBoard.getCol(c)) { - if (ce.getType() == StarBattleCellType.UNKNOWN) { - if (regions.add(ce.getGroupIndex())) { - regionStars += origBoard.getRegion(ce.getGroupIndex()).numStars(); - } - if (ce.getGroupIndex() == region) { - containsRegion = true; - } + while (!columnsToCheck.isEmpty() || !regionsToCheck.isEmpty()) { + for (int r : regionsToCheck) { + regionStars += board.getRegion(r).numStars(); + for (PuzzleElement c : board.getRegion(r).getCells()) { + int column = ((StarBattleCell) c).getLocation().x; + if (columns.add(column)) { + columnsToCheck.add(column); } } + regionsToCheck.remove(r); } - if (containsRegion && board.getPuzzleNumber() * columnSubset.size() - columnStars - >= board.getPuzzleNumber() * regions.size() - regionStars) { - return null; + for (int c : columnsToCheck) { + columnStars += board.columnStars(c); + for (int i = 0; i < board.getSize(); ++i) { + int region = board.getCell(c, i).getGroupIndex(); + if (regions.add(region)) { + regionsToCheck.add(region); + } + } + columnsToCheck.remove(c); } } - return "The columns must fully fit within regions with the same number of stars missing!"; + // are the columns and regions missing an equal amount of stars + if (board.getPuzzleNumber() * columns.size() - columnStars + != board.getPuzzleNumber() * regions.size() - regionStars) { + return "The number of missing stars in the columns and regions must be equal and every extraneous cell must be black!"; + } + return null; } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRowsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRowsDirectRule.java index da5c7bfd3..5d108a0cd 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRowsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/ColumnsWithinRowsDirectRule.java @@ -8,8 +8,8 @@ import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; import edu.rpi.legup.puzzle.starbattle.StarBattleCell; import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; - -import java.util.*; +import java.util.HashSet; +import java.util.Set; public class ColumnsWithinRowsDirectRule extends DirectRule { @@ -21,25 +21,6 @@ public ColumnsWithinRowsDirectRule() { "edu/rpi/legup/images/starbattle/rules/ColumnsWithinRowsDirectRule.png"); } - private void generateSubsets(List> subsets, int current, int skip, int size) { - if (current == size) { - return; - } - List> newSubsets = new LinkedList>(); - if (current != skip) { - for (List subset: subsets) { - List copy = new LinkedList(subset); - copy.add(current); - newSubsets.add(copy); - } - subsets.addAll(newSubsets); - List oneMember = new LinkedList(); - oneMember.add(current); - subsets.add(oneMember); - } - generateSubsets(subsets, current + 1 == skip ? current + 2 : current + 1, skip, size); - } - /** * Checks whether the child node logically follows from the parent node at the specific * puzzleElement index using this rule @@ -55,43 +36,52 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem // assumption: the rule has been applied to its fullest extent and the rows and columns // are now mutually encompassing StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleBoard origBoard = (StarBattleBoard) transition.getParents().get(0).getBoard(); StarBattleCell cell = (StarBattleCell) board.getPuzzleElement(puzzleElement); - int dim = board.getSize(); - int row = cell.getLocation().y; - int column = cell.getLocation().x; - if (cell.getType() != StarBattleCellType.BLACK) { return "Only black cells are allowed for this rule!"; } - List> subsets = new LinkedList>(); - generateSubsets(subsets,0, column, dim); + // the columns that are contained + Set columns = new HashSet(); + // the rows that contain them + Set rows = new HashSet(); + // columns and rows to process + Set columnsToCheck = new HashSet(); + Set rowsToCheck = new HashSet(); + int columnStars = 0; + int rowStars = 0; + int firstRow = cell.getLocation().y; + rows.add(firstRow); + rowsToCheck.add(firstRow); - for (List columnSubset: subsets) { - Set rows = new HashSet(); - boolean containsRow = false; - int columnStars = 0; - int rowStars = 0; - for (int c: columnSubset) { - columnStars += origBoard.columnStars(c); - for (StarBattleCell ce: origBoard.getCol(c)) { - if (ce.getType() == StarBattleCellType.UNKNOWN) { - if (rows.add(ce.getLocation().y)) { - rowStars += origBoard.rowStars(ce.getLocation().y); - } - if (ce.getLocation().y == row) { - containsRow = true; - } + while (!columnsToCheck.isEmpty() || !rowsToCheck.isEmpty()) { + for (int r : rowsToCheck) { + rowStars += board.rowStars(r); + for (PuzzleElement c : board.getRow(r)) { + int column = ((StarBattleCell) c).getLocation().x; + if (columns.add(column)) { + columnsToCheck.add(column); } } + rowsToCheck.remove(r); } - if (containsRow && board.getPuzzleNumber() * columnSubset.size() - columnStars - >= board.getPuzzleNumber() * rows.size() - rowStars) { - return null; + for (int c : columnsToCheck) { + columnStars += board.columnStars(c); + for (PuzzleElement r : board.getCol(c)) { + int row = ((StarBattleCell) r).getLocation().y; + if (rows.add(row)) { + rowsToCheck.add(row); + } + } + columnsToCheck.remove(c); } } - return "The columns must fully fit within rows with the same number of stars missing!"; + // are the columns and regions missing an equal amount of stars + if (board.getPuzzleNumber() * columns.size() - columnStars + != board.getPuzzleNumber() * rows.size() - rowStars) { + return "The number of missing stars in the columns and rows must be equal and every extraneous cell must be black!"; + } + return null; } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/EmptyAdjacentDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/EmptyAdjacentDirectRule.java deleted file mode 100644 index 0cb43ce06..000000000 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/EmptyAdjacentDirectRule.java +++ /dev/null @@ -1,95 +0,0 @@ -package edu.rpi.legup.puzzle.starbattle.rules; - -import edu.rpi.legup.model.gameboard.Board; -import edu.rpi.legup.model.gameboard.PuzzleElement; -import edu.rpi.legup.model.rules.ContradictionRule; -import edu.rpi.legup.model.rules.DirectRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.nurikabe.NurikabeCell; -import edu.rpi.legup.puzzle.nurikabe.NurikabeType; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; - -public class EmptyAdjacentDirectRule extends DirectRule { - - public EmptyAdjacentDirectRule() { - super( - "STBL-BASC-0010", - "Empty Adjacent", - "Tiles next to other tiles that need to contain a star to reach the puzzle number for their region/row/column need to be blacked out.", - "edu/rpi/legup/images/starbattle/rules/EmptyAdjacentDirectRule.png"); - } - - /** - * Checks whether the child node logically follows from the parent node at the specific - * puzzleElement index using this rule - * - * @param transition transition to check - * @param puzzleElement equivalent puzzleElement - * @return null if the child node logically follow from the parent node at the specified - * puzzleElement, otherwise error message - */ - @Override - public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleBoard origBoard = (StarBattleBoard) transition.getParents().get(0).getBoard(); - ContradictionRule contraRule = new TooFewStarsContradictionRule(); - - StarBattleCell cell = (StarBattleCell) board.getPuzzleElement(puzzleElement); - - if (cell.getType() != StarBattleCellType.BLACK) { - return super.getInvalidUseOfRuleMessage() - + ": Only black cells are allowed for this rule!"; - } - - int x = cell.getLocation().x; - int y = cell.getLocation().y; - - StarBattleCell northWest = board.getCell(x - 1, y - 1); - StarBattleCell north = board.getCell(x, y - 1); - StarBattleCell northEast = board.getCell(x + 1, y - 1); - StarBattleCell west = board.getCell(x - 1, y); - StarBattleCell east = board.getCell(x + 1, y); - StarBattleCell southWest = board.getCell(x - 1, y + 1); - StarBattleCell south = board.getCell(x, y + 1); - StarBattleCell southEast = board.getCell(x + 1, y + 1); - - StarBattleCell[] adjacent = {northWest, north, northEast, west, east, southWest, south, southEast}; - - StarBattleBoard modified = (StarBattleBoard) origBoard.copy(); - modified.getPuzzleElement(puzzleElement).setData(StarBattleCellType.STAR.value); - for(int i = 0; i < 8; i++){ //sets each spot to a black square if not filled - StarBattleCell temp = adjacent[i]; - - if (temp != null && temp.getType() == StarBattleCellType.UNKNOWN) { - //temp.setData(StarBattleCellType.BLACK.value); - int X = temp.getLocation().x; - int Y = temp.getLocation().y; - modified.getCell(X,Y).setData(StarBattleCellType.BLACK.value); - System.out.println("covering square " + X + " " + Y + " type " + modified.getCell(X,Y).getType() + " i = " + i + "\n"); - if(contraRule.checkContradictionAt(modified, temp) == null){ - System.out.println("Good job!"); - return null; //used correctly if even one space causes a toofewstars issue - } - } - } - System.out.println("Wait why did this exit?\n"); - - return "Black cells must be placed adjacent to a tile(s) where a star is needed!"; - } - - /** - * Creates a transition {@link Board} that has this rule applied to it using the {@link - * TreeNode}. - * - * @param node tree node used to create default transition board - * @return default board or null if this rule cannot be applied to this tree node - */ - @Override - public Board getDefaultBoard(TreeNode node) { - - return null; - } -} diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinColumnsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinColumnsDirectRule.java index 06d73cc1f..7022a06ac 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinColumnsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinColumnsDirectRule.java @@ -27,11 +27,7 @@ public RegionsWithinColumnsDirectRule() { @Override public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { ColumnsWithinRegionsDirectRule correspondingRule = new ColumnsWithinRegionsDirectRule(); - String result = correspondingRule.checkRuleRawAt(transition, puzzleElement); - if (result != null && result.equals("The columns must fully fit within regions with the same number of stars missing!")) { - return "The regions must fully fit within columns with the same number of stars missing!"; - } - return result; + return correspondingRule.checkRuleRawAt(transition, puzzleElement); } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinRowsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinRowsDirectRule.java index 012dc0640..7ab50d42b 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinRowsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RegionsWithinRowsDirectRule.java @@ -28,11 +28,7 @@ public RegionsWithinRowsDirectRule() { public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { RowsWithinRegionsDirectRule correspondingRule = new RowsWithinRegionsDirectRule(); - String result = correspondingRule.checkRuleRawAt(transition, puzzleElement); - if (result != null && result.equals("The rows must fully fit within regions with the same number of stars missing!")) { - return "The regions must fully fit within rows with the same number of stars missing!"; - } - return result; + return correspondingRule.checkRuleRawAt(transition, puzzleElement); } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinColumnsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinColumnsDirectRule.java index a22c31a59..2df20e464 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinColumnsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinColumnsDirectRule.java @@ -11,7 +11,7 @@ public class RowsWithinColumnsDirectRule extends DirectRule { public RowsWithinColumnsDirectRule() { super( "STBL-BASC-0007", - "Rows Within Columns", + "Rows Withing Columns", "If a number of rows is fully contained by a number of columns with an equal number of missing stars, spaces of other rows in those columns must be black.", "edu/rpi/legup/images/starbattle/rules/RowsWithinColumnsDirectRule.png"); } @@ -29,11 +29,7 @@ public RowsWithinColumnsDirectRule() { public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { ColumnsWithinRowsDirectRule correspondingRule = new ColumnsWithinRowsDirectRule(); - String result = correspondingRule.checkRuleRawAt(transition, puzzleElement); - if (result != null && result.equals("The columns must fully fit within rows with the same number of stars missing!")) { - return "The rows must fully fit within columns with the same number of stars missing!"; - } - return result; + return correspondingRule.checkRuleRawAt(transition, puzzleElement); } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinRegionsDirectRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinRegionsDirectRule.java index de9aaf044..78f8f00e7 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinRegionsDirectRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/RowsWithinRegionsDirectRule.java @@ -8,8 +8,8 @@ import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; import edu.rpi.legup.puzzle.starbattle.StarBattleCell; import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; - -import java.util.*; +import java.util.HashSet; +import java.util.Set; public class RowsWithinRegionsDirectRule extends DirectRule { public RowsWithinRegionsDirectRule() { @@ -20,25 +20,6 @@ public RowsWithinRegionsDirectRule() { "edu/rpi/legup/images/starbattle/rules/RowsWithinRegionsDirectRule.png"); } - private void generateSubsets(List> subsets, int current, int skip, int size) { - if (current == size) { - return; - } - List> newSubsets = new LinkedList>(); - if (current != skip) { - for (List subset: subsets) { - List copy = new LinkedList(subset); - copy.add(current); - newSubsets.add(copy); - } - subsets.addAll(newSubsets); - List oneMember = new LinkedList(); - oneMember.add(current); - subsets.add(oneMember); - } - generateSubsets(subsets, current + 1 == skip ? current + 2 : current + 1, skip, size); - } - /** * Checks whether the child node logically follows from the parent node at the specific * puzzleElement index using this rule @@ -54,81 +35,42 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem // assumption: the rule has been applied to its fullest extent and the rows and regions // are now mutually encompassing StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleBoard origBoard = (StarBattleBoard) transition.getParents().get(0).getBoard(); StarBattleCell cell = (StarBattleCell) board.getPuzzleElement(puzzleElement); - int dim = board.getSize(); - int region = cell.getGroupIndex(); - int row = cell.getLocation().y; - if (cell.getType() != StarBattleCellType.BLACK) { return "Only black cells are allowed for this rule!"; } - - List> subsets = new LinkedList>(); - generateSubsets(subsets,0, row, dim); - - for (List rowSubset: subsets) { - Set regions = new HashSet(); - boolean containsRegion = false; - int rowStars = 0; - int regionStars = 0; - for (int r: rowSubset) { - rowStars += origBoard.rowStars(r); - for (StarBattleCell ce: origBoard.getRow(r)) { - if (ce.getType() == StarBattleCellType.UNKNOWN) { - if (regions.add(ce.getGroupIndex())) { - regionStars += origBoard.getRegion(ce.getGroupIndex()).numStars(); - } - if (ce.getGroupIndex() == region) { - containsRegion = true; - } - } - } - } - if (containsRegion && board.getPuzzleNumber() * rowSubset.size() - rowStars - >= board.getPuzzleNumber() * regions.size() - regionStars) { - return null; - } - } - return "The rows must fully fit within regions with the same number of stars missing!"; - - /* // the rows that are contained Set rows = new HashSet(); // the regions that contain them Set regions = new HashSet(); // rows and regions to process - List rowsToCheck = new ArrayList(); - List regionsToCheck = new ArrayList(); + Set rowsToCheck = new HashSet(); + Set regionsToCheck = new HashSet(); int rowStars = 0; int regionStars = 0; regions.add(cell.getGroupIndex()); regionsToCheck.add(cell.getGroupIndex()); while (!rowsToCheck.isEmpty() || !regionsToCheck.isEmpty()) { - for (int i = 0; i < regionsToCheck.size(); ++i) { - int r = regionsToCheck.get(i); + for (int r : regionsToCheck) { regionStars += board.getRegion(r).numStars(); - for (StarBattleCell ro : board.getRegion(r).getCells()) { - int row = ro.getLocation().y; - if (ro.getType() == StarBattleCellType.UNKNOWN && rows.add(row)) { + for (PuzzleElement ro : board.getRegion(r).getCells()) { + int row = ((StarBattleCell) ro).getLocation().y; + if (rows.add(row)) { rowsToCheck.add(row); } } - regionsToCheck.remove(i); - --i; + regionsToCheck.remove(r); } - for (int j = 0; j < rowsToCheck.size(); ++j) { - int r = rowsToCheck.get(j); + for (int r : rowsToCheck) { rowStars += board.rowStars(r); for (int i = 0; i < board.getSize(); ++i) { int region = board.getCell(i, r).getGroupIndex(); - if (board.getCell(i,r).getType() == StarBattleCellType.UNKNOWN && regions.add(region)) { + if (regions.add(region)) { regionsToCheck.add(region); } } - rowsToCheck.remove(j); - --j; + rowsToCheck.remove(r); } } // are the columns and regions missing an equal amount of stars @@ -136,12 +78,7 @@ public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElem != board.getPuzzleNumber() * regions.size() - regionStars) { return "The number of missing stars in the rows and regions must be equal and every extraneous cell must be black!"; } - if (rows.contains(cell.getLocation().y)) { - return "Only black out cells outside the row(s)!"; - } return null; - - */ } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/TooFewStarsContradictionRule.java b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/TooFewStarsContradictionRule.java index 358e5b9bd..e88b7c6b9 100644 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/TooFewStarsContradictionRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/TooFewStarsContradictionRule.java @@ -38,16 +38,14 @@ public String checkContradictionAt(Board board, PuzzleElement puzzleElement) { int rowCount = 0; int columnCount = 0; for (int i = 0; i < sbBoard.getSize(); ++i) { - if (sbBoard.getCell(i, row).getType() != StarBattleCellType.BLACK) { + if (sbBoard.getCell(row, i).getType() != StarBattleCellType.BLACK) { ++rowCount; } - if (sbBoard.getCell(column, i).getType() != StarBattleCellType.BLACK) { + if (sbBoard.getCell(i, column).getType() != StarBattleCellType.BLACK) { ++columnCount; } } - System.out.println("rowCount = " + rowCount + " columnCount = " + columnCount + " at " + column + "," + row + "\n"); if (rowCount < sbBoard.getPuzzleNumber() || columnCount < sbBoard.getPuzzleNumber()) { - System.out.println("Returning Null\n"); return null; } StarBattleRegion region = sbBoard.getRegion(cell); diff --git a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt deleted file mode 100644 index c332fcee0..000000000 --- a/src/main/java/edu/rpi/legup/puzzle/starbattle/rules/starbattle_reference_sheet.txt +++ /dev/null @@ -1,20 +0,0 @@ -Case Rules: -Add Star: STBL-CASE-0001 -Star or Empty: STBL-CASE-0002 - -Basic Rules: -Blackout: STBL-BASC-0001 -Columns Within Regions: STBL-BASC-0002 -Columns Within Rows: STBL-BASC-0003 -Finish With Stars: STBL-BASC-0004 -Regions Within Columns: STBL-BASC-0005 -Regions Within Rows: STBL-BASC-0006 -Rows Within Columns: STBL-BASC-0007 -Rows Within Regions: STBL-BASC-0008 -Surround Star: STBL-BASC-0009 -Empty Adjacent: STBL-BASC-0010 - -Contradiction Rules: -Too Many Stars: STBL-CONT-0001 -Too Few Stars: STBL-CONT-0002 -Clashing Orbit: STBL-CONT-0003 \ No newline at end of file diff --git a/src/main/resources/edu/rpi/legup/images/starbattle/rules/EmptyAdjacentDirectRule.png b/src/main/resources/edu/rpi/legup/images/starbattle/rules/EmptyAdjacentDirectRule.png deleted file mode 100644 index db3c0d9d5..000000000 Binary files a/src/main/resources/edu/rpi/legup/images/starbattle/rules/EmptyAdjacentDirectRule.png and /dev/null differ diff --git a/src/test/java/puzzles/starbattle/rules/BlackoutDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/BlackoutDirectRuleTest.java index 76367ace5..59d5b37af 100644 --- a/src/test/java/puzzles/starbattle/rules/BlackoutDirectRuleTest.java +++ b/src/test/java/puzzles/starbattle/rules/BlackoutDirectRuleTest.java @@ -1,216 +1,76 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.puzzle.starbattle.rules.BlackoutDirectRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class BlackoutDirectRuleTest { - private static final BlackoutDirectRule RULE = new BlackoutDirectRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - /* Blackout Direct Rule where star is in the corner */ - @Test - public void BlackoutDirectRuleTestCorner() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/BlackoutDirectRule/Corner", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(3,0); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(0,1); - cell4.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell5 = board.getCell(1,1); - cell5.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell6 = board.getCell(0,2); - cell6.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell7 = board.getCell(0,3); - cell7.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - board.addModifiedData(cell5); - board.addModifiedData(cell6); - board.addModifiedData(cell7); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,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())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /* Blackout Direct Rule where star is on the edge */ - @Test - public void BlackoutDirectRuleTestEdge() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/BlackoutDirectRule/Edge", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(3,0); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(0,1); - cell4.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell5 = board.getCell(1,1); - cell5.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell6 = board.getCell(1,2); - cell6.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell7 = board.getCell(1,3); - cell7.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - board.addModifiedData(cell5); - board.addModifiedData(cell6); - board.addModifiedData(cell7); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,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())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Blackout Direct Rule where star is on the edge */ - @Test - public void BlackoutDirectRuleTestMiddle() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/BlackoutDirectRule/Middle", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(1,0); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(0,1); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(2,1); - cell4.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell5 = board.getCell(3,1); - cell5.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell6 = board.getCell(1,2); - cell6.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell7 = board.getCell(1,3); - cell7.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - board.addModifiedData(cell5); - board.addModifiedData(cell6); - board.addModifiedData(cell7); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,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())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /* Blackout Direct Rule where rule is called incorrectly */ - @Test - public void BlackoutDirectRuleTestFalse() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/BlackoutDirectRule/Middle", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,2); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,3); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(3,2); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(3,3); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - - Assert.assertNotNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - - -} +// This test is for a puzzle that is not fully implemented yet and is causing issues. +// Commenting this out for now, but once Star Battle is fully implemented this should +// be uncommented and finished. + +// package puzzles.starbattle.rules; +// +// import edu.rpi.legup.puzzle.nurikabe.Nurikabe; +// import edu.rpi.legup.puzzle.nurikabe.NurikabeBoard; +// import edu.rpi.legup.puzzle.nurikabe.NurikabeCell; +// import edu.rpi.legup.puzzle.nurikabe.NurikabeType; +// import legup.MockGameBoardFacade; +// import legup.TestUtilities; +// import edu.rpi.legup.model.tree.TreeNode; +// import edu.rpi.legup.model.tree.TreeTransition; +// import org.junit.Assert; +// import org.junit.BeforeClass; +// import org.junit.Test; +// +// import edu.rpi.legup.puzzle.starbattle.StarBattle; +// import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; +// import edu.rpi.legup.puzzle.starbattle.StarBattleCell; +// import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; +// import edu.rpi.legup.puzzle.starbattle.rules.BlackoutDirectRule; +// import edu.rpi.legup.save.InvalidFileFormatException; +// +// import java.awt.*; +// +// public class BlackoutDirectRuleTest { +// +// private static final BlackoutDirectRule RULE = new BlackoutDirectRule(); +// private static StarBattle starbattle; +// +// @BeforeClass +// public static void setUp() { +// MockGameBoardFacade.getInstance(); +// starbattle = new StarBattle(); +// } +// +// @Test +// public void BlackoutDirectRuleTest_ColumnBlackout() throws InvalidFileFormatException { +// +// TestUtilities.importTestBoard("puzzles/starbattle/rules/BlackoutDirectRule/ColumnBlackout", +// starbattle); +// TreeNode rootNode = starbattle.getTree().getRootNode(); +// TreeTransition transition = rootNode.getChildren().get(0); +// transition.setRule(RULE); +// +// StarBattleBoard board = (StarBattleBoard) transition.getBoard(); +// +// StarBattleCell cell1 = board.getCell(1, 1); +// cell1.setData(StarBattleCellType.BLACK.value); +// StarBattleCell cell2 = board.getCell(1, 2); +// cell2.setData(StarBattleCellType.BLACK.value); +// StarBattleCell cell3 = board.getCell(1, 3); +// cell3.setData(StarBattleCellType.BLACK.value); +// +// board.addModifiedData(cell1); +// board.addModifiedData(cell2); +// board.addModifiedData(cell3); +// +// 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())) { +// Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); +// } +// else { +// Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); +// } +// } +// } +// } +// } diff --git a/src/test/java/puzzles/starbattle/rules/ClashingOrbitContradictionRuleTest.java b/src/test/java/puzzles/starbattle/rules/ClashingOrbitContradictionRuleTest.java deleted file mode 100644 index ae8aaa08e..000000000 --- a/src/test/java/puzzles/starbattle/rules/ClashingOrbitContradictionRuleTest.java +++ /dev/null @@ -1,137 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.puzzle.starbattle.rules.ClashingOrbitContradictionRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class ClashingOrbitContradictionRuleTest { - - private static final ClashingOrbitContradictionRule RULE = new ClashingOrbitContradictionRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - /*Tests the Clashing Orbit contradiction rule for directly adjacent stars not at the - edge of the board */ - @Test - public void ClashingOrbitContradictionRule_DirectlyAdjacentCenter() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentCenter", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - StarBattleCell cell2 = board.getCell(2,1); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Tests the Clashing Orbit contradiction rule for diagonally adjacent stars */ - @Test - public void ClashingOrbitContradictionRule_DiagonallyAdjacent() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ClashingOrbitContradictionRule/DiagonallyAdjacent", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - StarBattleCell cell2 = board.getCell(2,2); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /*Tests the Clashing Orbit contradiction rule for stars at the edge of the board */ - @Test - public void ClashingOrbitContradictionRule_DirectlyAdjacentEdge() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentEdge", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(1,0); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /*Tests the Clashing Orbit contradiction rule for a false contradiction. */ - @Test - public void ClashingOrbitContradictionRule_FalseContradiction() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ClashingOrbitContradictionRule/FalseContradiction", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - - Assert.assertNotNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } -} diff --git a/src/test/java/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRuleTest.java deleted file mode 100644 index 185d31f5c..000000000 --- a/src/test/java/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRuleTest.java +++ /dev/null @@ -1,324 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.ColumnsWithinRegionsDirectRule; -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.awt.*; - -public class ColumnsWithinRegionsDirectRuleTest { - - private static final ColumnsWithinRegionsDirectRule RULE = new ColumnsWithinRegionsDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void ColumnsWithinRegionsDirectRule_OneColumnOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(1,0); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1, 0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_PartialColumnOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(1,2); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1, 2); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_PartialColumnTwoCells() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnTwoCells", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(0, 1); - Point location2 = new Point(2,1); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_TwoColumns() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumns", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,2); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(2, 1); - Point location2 = new Point(2,2); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - /* Wrote this to figure out the specifics of how the rule is functioning - might change - * what the expected result is. */ - @Test - public void ColumnsWithinRegionsDirectRule_TwoColumnsWaitAMinute() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumns", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(2, 1); - 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(location1)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_TwoColumnsStarOverlap() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumnsStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,3); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(2, 3); - 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(location1)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_FalseColumnsWithinRegions1() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(0,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(1, 0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_FalseColumnsWithinRegions2() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,1); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(1, 0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_PartialRemoval() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnTwoCells", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(0, 1); - 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(location1)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRegionsDirectRule_FalseColumnsWithinRegions4() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/FalseStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,2); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,3); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(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/starbattle/rules/ColumnsWithinRowsDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/ColumnsWithinRowsDirectRuleTest.java deleted file mode 100644 index 8f9c938cb..000000000 --- a/src/test/java/puzzles/starbattle/rules/ColumnsWithinRowsDirectRuleTest.java +++ /dev/null @@ -1,244 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.ColumnsWithinRowsDirectRule; -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.awt.*; - -public class ColumnsWithinRowsDirectRuleTest { - - private static final ColumnsWithinRowsDirectRule RULE = new ColumnsWithinRowsDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void ColumnsWithinRowsDirectRule_OneColumn() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(1, 0); - Point location2 = new Point(2,0); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_TwoColumns() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumns", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(2, 1); - Point location2 = new Point(2,0); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_NonAdjacentColumns() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/NonAdjacentColumns", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,2); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(1, 0); - Point location2 = new Point(1,2); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_TwoColumnsStarOverlap() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumnsStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(3,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(2, 1); - Point location2 = new Point(3,0); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_FalseColumnsWithinRows1() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - StarBattleCell cell3 = board.getCell(1,1); - cell3.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell3); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location1 = new Point(1, 0); - Point location2 = new Point(2,0); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_PartialCover() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1,0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void ColumnsWithinRowsDirectRule_FalseColumnsWithinRows3() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/FalseStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - - Assert.assertNotNull(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/starbattle/rules/EmptyAdjacentDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/EmptyAdjacentDirectRuleTest.java deleted file mode 100644 index c81c74657..000000000 --- a/src/test/java/puzzles/starbattle/rules/EmptyAdjacentDirectRuleTest.java +++ /dev/null @@ -1,177 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.EmptyAdjacentDirectRule; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class EmptyAdjacentDirectRuleTest { - - private static final EmptyAdjacentDirectRule RULE = new EmptyAdjacentDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void EmptyAdjacentDirectRule_OneLeft() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/EmptyAdjacentDirectRule/OneLeft", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(3,1); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(1,3); - cell4.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell5 = board.getCell(2,3); - cell5.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell6 = board.getCell(3,3); - cell6.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - board.addModifiedData(cell5); - board.addModifiedData(cell6); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,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())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - @Test - public void EmptyAdjacentDirectRule_TwoLeft() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/EmptyAdjacentDirectRule/TwoLeft", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.BLACK.value); - /* - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(1,3); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(2,3); - cell4.setData(StarBattleCellType.BLACK.value); - */ - - board.addModifiedData(cell1); - /* - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - */ - - Assert.assertNull(RULE.checkRule(transition)); - System.out.println("General Case is done\n"); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } /* - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } */ - } - } - } - - @Test - public void EmptyAdjacentDirectRule_ThreeLeft() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/EmptyAdjacentDirectRule/TwoLeft", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - @Test - public void EmptyAdjacentDirectRule_ImproperUseFourLeft() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/EmptyAdjacentDirectRule/ImproperUseFourLeft", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell3 = board.getCell(1,3); - cell3.setData(StarBattleCellType.BLACK.value); - StarBattleCell cell4 = board.getCell(2,3); - cell4.setData(StarBattleCellType.BLACK.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - board.addModifiedData(cell3); - board.addModifiedData(cell4); - - Assert.assertNotNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } -} diff --git a/src/test/java/puzzles/starbattle/rules/FinishWithStarsDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/FinishWithStarsDirectRuleTest.java deleted file mode 100644 index 552e3703e..000000000 --- a/src/test/java/puzzles/starbattle/rules/FinishWithStarsDirectRuleTest.java +++ /dev/null @@ -1,209 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.puzzle.starbattle.rules.FinishWithStarsDirectRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class FinishWithStarsDirectRuleTest { - private static final FinishWithStarsDirectRule RULE = new FinishWithStarsDirectRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - /* Finish With Stars Direct Rule where star is in the corner and only the row is blacked out */ - @Test - public void FinishWithStarsDirectRuleTestCornerRow() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRow", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - cell1.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Finish With Stars Direct Rule where star is in the corner and only the column is blacked out */ - @Test - public void FinishWithStarsDirectRuleTestCornerColumn() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerColumn", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - cell1.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Finish With Stars Direct Rule where star is in the corner and only the column is blacked out */ - @Test - public void FinishWithStarsDirectRuleTestCornerRowColumn() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRowColumn", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - cell1.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /* Finish With Stars Direct Rule where star is in the corner and only the column is blacked out */ - @Test - public void FinishWithStarsDirectRuleTestRegion() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/Region", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /* Finish With Stars Direct Rule where there are two stars in two different mostly blacked out regions */ - @Test - public void FinishWithStarsDirectRuleTestDoubleRegion() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/DoubleRegion", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.STAR.value); - StarBattleCell cell2 = board.getCell(2,3); - cell2.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Finish With Stars Direct Rule where there are two stars in two different mostly blacked out regions */ - @Test - public void FinishWithStarsDirectRuleTestFalse() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/FinishWithStarsDirectRule/False", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,0); - cell1.setData(StarBattleCellType.STAR.value); - - board.addModifiedData(cell1); - - Assert.assertNotNull(RULE.checkRule(transition)); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - -} diff --git a/src/test/java/puzzles/starbattle/rules/RegionsWithinColumnsDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/RegionsWithinColumnsDirectRuleTest.java deleted file mode 100644 index a45f7455f..000000000 --- a/src/test/java/puzzles/starbattle/rules/RegionsWithinColumnsDirectRuleTest.java +++ /dev/null @@ -1,353 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.RegionsWithinColumnsDirectRule; -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.awt.*; - -public class RegionsWithinColumnsDirectRuleTest { - - private static final RegionsWithinColumnsDirectRule RULE = new RegionsWithinColumnsDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void RegionsWithinColumnsDirectRule_OneRegionOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,2); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(0,2); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_OneRegionTwoCells() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionTwoCells", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(0,2); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(0,1); - Point location2 = new Point(0,2); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_PartialRegionOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/PartialRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,2); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(0,2); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_TwoRegionsOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(1,3); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1,3); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_TwoRegionsTwoCells() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,3); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(1,1); - Point location2 = new Point(1,3); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_TwoRegionsTwoCells2() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells2", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,3); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,3); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(0,3); - Point location2 = new Point(1,3); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_TwoRegionsStarOverlap() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(1,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1,1); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_FalseRegionsWithinColumns1() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,2); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - StarBattleCell cell2 = board.getCell(1,2); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(0,2); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_FalseRegionsWithinColumns2() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,2); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - StarBattleCell cell2 = board.getCell(0,1); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(0,2); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_FalseRegionsWithinColumns3() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/FalseStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(1,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - StarBattleCell cell2 = board.getCell(1,3); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(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))); - } - } - } - - @Test - public void RegionsWithinColumnsDirectRule_FalseRegionsWithinColumns4() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells2", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,3); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(0,3); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } -} diff --git a/src/test/java/puzzles/starbattle/rules/RegionsWithinRowsDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/RegionsWithinRowsDirectRuleTest.java deleted file mode 100644 index 3ffaa82fd..000000000 --- a/src/test/java/puzzles/starbattle/rules/RegionsWithinRowsDirectRuleTest.java +++ /dev/null @@ -1,258 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.RegionsWithinRowsDirectRule; -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.awt.*; - -public class RegionsWithinRowsDirectRuleTest { - - private static final RegionsWithinRowsDirectRule RULE = new RegionsWithinRowsDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void RegionsWithinRowsDirectRule_OneRegionOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(2,0); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(2,0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_PartialRegionOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(2,0); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(2,0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_PartialRegionTwo() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionTwoCells", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(1,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(1,0); - Point location2 = new Point(2,0); - 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(location1) || point.equals(location2)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_TwoRegionsOneCell() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/TwoRegionsOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(3,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(3,1); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_StarOverlap() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/StarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(3,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(3,1); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_FalseRegionsWithinRows1() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(2,1); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(2,0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_FalseRegionsWithinRows2() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,0); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - - Assert.assertNotNull(RULE.checkRule(transition)); - - Point location = new Point(2,0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void RegionsWithinRowsDirectRule_FalseStarOverlap() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/RegionsWithinRowsDirectRule/FalseStarOverlap", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(3,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNotNull(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/starbattle/rules/StarOrEmptyCaseRuleTest.java b/src/test/java/puzzles/starbattle/rules/StarOrEmptyCaseRuleTest.java deleted file mode 100644 index e1f9cb990..000000000 --- a/src/test/java/puzzles/starbattle/rules/StarOrEmptyCaseRuleTest.java +++ /dev/null @@ -1,68 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.gameboard.Board; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.nurikabe.NurikabeType; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.StarOrEmptyCaseRule; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import java.util.ArrayList; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class StarOrEmptyCaseRuleTest { - - private static final StarOrEmptyCaseRule RULE = new StarOrEmptyCaseRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - @Test - public void StarOrEmptyCaseRuleTest_SimpleStarOrEmpty() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/StarOrEmptyCaseRule/SimpleStarOrEmpty", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,0); - ArrayList cases = RULE.getCases(board, cell); - - StarBattleBoard caseBoard1 = (StarBattleBoard) cases.get(0); - StarBattleBoard caseBoard2 = (StarBattleBoard) cases.get(1); - StarBattleCellType board1Type = caseBoard1.getCell(0, 0).getType(); - StarBattleCellType board2Type = caseBoard2.getCell(0, 0).getType(); - - Assert.assertTrue( - (board1Type.equals(StarBattleCellType.BLACK) || board1Type.equals(StarBattleCellType.STAR)) - && (board2Type.equals(StarBattleCellType.BLACK) - || board2Type.equals(StarBattleCellType.STAR))); - Assert.assertFalse(board1Type.equals(board2Type)); - Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); - Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); - - for (int i = 0; i < caseBoard1.getHeight(); i++) { - for (int k = 0; k < caseBoard1.getWidth(); k++) { - Point point = new Point(k, i); - if (point.equals(caseBoard1.getCell(k, i).getLocation())) { - continue; - } - Assert.assertTrue(caseBoard1.getCell(k, i).equals(caseBoard2.getCell(k, i))); - } - } - } - -} diff --git a/src/test/java/puzzles/starbattle/rules/SurroundStarDirectRuleTest.java b/src/test/java/puzzles/starbattle/rules/SurroundStarDirectRuleTest.java deleted file mode 100644 index db55d0f65..000000000 --- a/src/test/java/puzzles/starbattle/rules/SurroundStarDirectRuleTest.java +++ /dev/null @@ -1,173 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.SurroundStarDirectRule; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class SurroundStarDirectRuleTest { - - private static final SurroundStarDirectRule RULE = new SurroundStarDirectRule(); - private static StarBattle starbattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starbattle = new StarBattle(); - } - - @Test - public void SurroundStarDirectRule_CenterStarOneTile() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,1); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(0, 1); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void SurroundStarDirectRule_CenterStarOneTileDiagonal() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(0,0); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(0, 0); - 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(location)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void SurroundStarDirectRule_CenterStarAllTiles() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - for (int i = 0; i < board.getWidth(); i++) { - for (int j = 0; j < board.getHeight(); j++) { - if (i != 1 || j != 1) { - StarBattleCell cell = board.getCell(i,j); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - } - } - } - - Assert.assertNull(RULE.checkRule(transition)); - - Point location = new Point(1, 1); - 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(location)) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void SurroundStarDirectRule_CornerStar() throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/SurroundStarDirectRule/CornerStar", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,1); - cell1.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell1); - StarBattleCell cell2 = board.getCell(1,0); - cell2.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell2); - StarBattleCell cell3 = board.getCell(1,1); - cell3.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell3); - - Assert.assertNull(RULE.checkRule(transition)); - - Point location1 = new Point(0, 1); - Point location2 = new Point(1,0); - Point location3 = new Point(1,1); - 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(location1) || point.equals(location2) || point.equals(location3)) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(k, i))); - } - } - } - } - - @Test - public void SurroundStarDirectRule_FalseSurroundStar() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/SurroundStarDirectRule/CornerStar", starbattle); - TreeNode rootNode = starbattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell = board.getCell(2,0); - cell.setData(StarBattleCellType.BLACK.value); - board.addModifiedData(cell); - - Assert.assertNotNull(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/starbattle/rules/TooFewStarsContradictionRuleTest.java b/src/test/java/puzzles/starbattle/rules/TooFewStarsContradictionRuleTest.java deleted file mode 100644 index 2c90c6fb2..000000000 --- a/src/test/java/puzzles/starbattle/rules/TooFewStarsContradictionRuleTest.java +++ /dev/null @@ -1,205 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.puzzle.starbattle.rules.ClashingOrbitContradictionRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.puzzle.starbattle.rules.TooFewStarsContradictionRule; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class TooFewStarsContradictionRuleTest { - private static final TooFewStarsContradictionRule RULE = new TooFewStarsContradictionRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - /*Too few stars in column */ - @Test - public void TooFewStarsContradictionRule_Column() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/Column", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(0,1); - StarBattleCell cell3 = board.getCell(0,2); - StarBattleCell cell4 = board.getCell(0,3); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation()) || - point.equals(cell3.getLocation()) || point.equals(cell4.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - - } - - /*Too few stars in row*/ - @Test - public void TooFewStarsContradictionRule_Row() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/Row", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(1,0); - StarBattleCell cell3 = board.getCell(2,0); - StarBattleCell cell4 = board.getCell(3,0); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation()) || - point.equals(cell3.getLocation()) || point.equals(cell4.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /*Too few stars in region*/ - @Test - public void TooFewStarsContradictionRule_Region() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/Region", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(0,1); - StarBattleCell cell3 = board.getCell(1,0); - StarBattleCell cell4 = board.getCell(1,1); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation()) || - point.equals(cell3.getLocation()) || point.equals(cell4.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /*False contradiction*/ - @Test - public void TooFewStarsContradictionRule_FalseContradiction() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/FalseContradiction", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - - Assert.assertNotNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - - @Test - public void TooFewStarsContradictionRule_NotEnoughSpace() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/NotEnoughSpace", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - - @Test - public void TooFewStarsContradictionRule_TwoStarColumn() - throws InvalidFileFormatException { - - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarColumn", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(0,1); - StarBattleCell cell3 = board.getCell(0,2); - StarBattleCell cell4 = board.getCell(0,3); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation()) || - point.equals(cell3.getLocation()) || point.equals(cell4.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - @Test - public void TooFewStarsContradictionRule_TwoStarFalseContradiction() - throws InvalidFileFormatException { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarFalseContradiction", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - - Assert.assertNotNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - -} diff --git a/src/test/java/puzzles/starbattle/rules/TooManyStarsContradictionRuleTests.java b/src/test/java/puzzles/starbattle/rules/TooManyStarsContradictionRuleTests.java deleted file mode 100644 index 3424bbaac..000000000 --- a/src/test/java/puzzles/starbattle/rules/TooManyStarsContradictionRuleTests.java +++ /dev/null @@ -1,137 +0,0 @@ -package puzzles.starbattle.rules; - -import edu.rpi.legup.puzzle.starbattle.rules.TooManyStarsContradictionRule; -import edu.rpi.legup.model.tree.TreeNode; -import edu.rpi.legup.model.tree.TreeTransition; -import edu.rpi.legup.puzzle.starbattle.StarBattle; -import edu.rpi.legup.puzzle.starbattle.StarBattleBoard; -import edu.rpi.legup.puzzle.starbattle.StarBattleCell; -import edu.rpi.legup.puzzle.starbattle.StarBattleCellType; -import edu.rpi.legup.save.InvalidFileFormatException; -import java.awt.*; -import legup.MockGameBoardFacade; -import legup.TestUtilities; -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; - -public class TooManyStarsContradictionRuleTests { - private static final TooManyStarsContradictionRule RULE = new TooManyStarsContradictionRule(); - private static StarBattle starBattle; - - @BeforeClass - public static void setUp() { - MockGameBoardFacade.getInstance(); - starBattle = new StarBattle(); - } - - /* Tests the Too Many Stars contradiction rule where a region has - more stars than the puzzle number */ - @Test - public void TooManyStarsContradictionRule_RegionOverloaded() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooManyStarsContradictionRule/RegionOverloaded", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(2,1); - StarBattleCell cell2 = board.getCell(0,2); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - - /* Tests the Too Many Stars contradiction rule where a column has - more stars than the puzzle number */ - @Test - public void TooManyStarsContradictionRule_ColumnOverloaded() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooManyStarsContradictionRule/ColumnOverloaded", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(0,3); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /* Tests the Too Many Stars contradiction rule where a row has - more stars than the puzzle number */ - @Test - public void TooManyStarsContradictionRule_RowOverloaded() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooManyStarsContradictionRule/RowOverloaded", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - StarBattleCell cell1 = board.getCell(0,0); - StarBattleCell cell2 = board.getCell(3,0); - - Assert.assertNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - if (point.equals(cell1.getLocation()) || point.equals(cell2.getLocation())) { - Assert.assertNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - else { - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } - } - /*Tests the Too Many Stars contradiction rule for a false contradiction. */ - @Test - public void TooManyStarsContradictionRule_FalseContradiction() - throws InvalidFileFormatException - { - TestUtilities.importTestBoard("puzzles/starbattle/rules/TooManyStarsContradictionRule/Correct", starBattle); - TreeNode rootNode = starBattle.getTree().getRootNode(); - TreeTransition transition = rootNode.getChildren().get(0); - transition.setRule(RULE); - - StarBattleBoard board = (StarBattleBoard) transition.getBoard(); - - Assert.assertNotNull(RULE.checkContradiction((StarBattleBoard) transition.getBoard())); - - for (int i = 0; i < board.getHeight(); ++i) { - for (int j = 0; j < board.getWidth(); ++j) { - Point point = new Point(j,i); - Assert.assertNotNull(RULE.checkRuleAt(transition, board.getCell(j, i))); - } - } - } -} diff --git a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Blackout visualized.png b/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Blackout visualized.png deleted file mode 100644 index e8670e07e..000000000 Binary files a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Blackout visualized.png and /dev/null differ diff --git a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Corner b/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Corner deleted file mode 100644 index d1c6722e4..000000000 --- a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Corner +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Edge b/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Edge deleted file mode 100644 index 7995657c9..000000000 --- a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Edge +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Middle b/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Middle deleted file mode 100644 index b6f483244..000000000 --- a/src/test/resources/puzzles/starbattle/rules/BlackoutDirectRule/Middle +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DiagonallyAdjacent b/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DiagonallyAdjacent deleted file mode 100644 index f63daad23..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DiagonallyAdjacent +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentCenter b/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentCenter deleted file mode 100644 index b57a5989e..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentCenter +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentEdge b/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentEdge deleted file mode 100644 index f5a23b081..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/DirectlyAdjacentEdge +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/FalseContradiction b/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/FalseContradiction deleted file mode 100644 index 04a4a6f6c..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ClashingOrbitContradictionRule/FalseContradiction +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/FalseStarOverlap b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/FalseStarOverlap deleted file mode 100644 index 8a435e5d7..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/FalseStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell deleted file mode 100644 index 4d065b28f..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/OneColumnOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnOneCell b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnOneCell deleted file mode 100644 index 5c3fc22cc..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnTwoCells b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnTwoCells deleted file mode 100644 index 463f3a6d7..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/PartialColumnTwoCells +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumns b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumns deleted file mode 100644 index ad5e4d198..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumns +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumnsStarOverlap b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumnsStarOverlap deleted file mode 100644 index 8562a47a8..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRegionsDirectRule/TwoColumnsStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/FalseStarOverlap b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/FalseStarOverlap deleted file mode 100644 index c0ac99a0b..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/FalseStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/NonAdjacentColumns b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/NonAdjacentColumns deleted file mode 100644 index 8d71ffa4f..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/NonAdjacentColumns +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn deleted file mode 100644 index 9a4dccefd..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/OneColumn +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumns b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumns deleted file mode 100644 index 5c13d38e6..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumns +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumnsStarOverlap b/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumnsStarOverlap deleted file mode 100644 index fac44ff20..000000000 --- a/src/test/resources/puzzles/starbattle/rules/ColumnsWithinRowsDirectRule/TwoColumnsStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ImproperUseFourLeft b/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ImproperUseFourLeft deleted file mode 100644 index 782c1d37d..000000000 --- a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ImproperUseFourLeft +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/OneLeft b/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/OneLeft deleted file mode 100644 index 29005798d..000000000 --- a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/OneLeft +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ThreeLeft b/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ThreeLeft deleted file mode 100644 index ab6f4b178..000000000 --- a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/ThreeLeft +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/TwoLeft b/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/TwoLeft deleted file mode 100644 index 5e8d71fbb..000000000 --- a/src/test/resources/puzzles/starbattle/rules/EmptyAdjacentDirectRule/TwoLeft +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerColumn b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerColumn deleted file mode 100644 index ac0e35380..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerColumn +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRow b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRow deleted file mode 100644 index 3fb595a65..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRow +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRowColumn b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRowColumn deleted file mode 100644 index 44fe2b9ba..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/CornerRowColumn +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/DoubleRegion b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/DoubleRegion deleted file mode 100644 index 16171cd01..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/DoubleRegion +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/False b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/False deleted file mode 100644 index 16ab2cc7c..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/False +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/Region b/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/Region deleted file mode 100644 index d3c74607f..000000000 --- a/src/test/resources/puzzles/starbattle/rules/FinishWithStarsDirectRule/Region +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/FalseStarOverlap b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/FalseStarOverlap deleted file mode 100644 index 812f00b66..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/FalseStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell deleted file mode 100644 index c459a9231..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionTwoCells b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionTwoCells deleted file mode 100644 index 50a775d0b..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/OneRegionTwoCells +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/PartialRegionOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/PartialRegionOneCell deleted file mode 100644 index 057dc96f0..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/PartialRegionOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsOneCell deleted file mode 100644 index 0ee0205ab..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsOneCell +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsStarOverlap b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsStarOverlap deleted file mode 100644 index e7495cabf..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells deleted file mode 100644 index cea670809..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells2 b/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells2 deleted file mode 100644 index 01ecce3ee..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinColumnsDirectRule/TwoRegionsTwoCells2 +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/FalseStarOverlap b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/FalseStarOverlap deleted file mode 100644 index a582d1c46..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/FalseStarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell deleted file mode 100644 index 056b67059..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/OneRegionOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionOneCell deleted file mode 100644 index eb9a69787..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionOneCell +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionTwoCells b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionTwoCells deleted file mode 100644 index 0654ed4dc..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/PartialRegionTwoCells +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/StarOverlap b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/StarOverlap deleted file mode 100644 index 5a6901ead..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/StarOverlap +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/TwoRegionsOneCell b/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/TwoRegionsOneCell deleted file mode 100644 index 4e19386e4..000000000 --- a/src/test/resources/puzzles/starbattle/rules/RegionsWithinRowsDirectRule/TwoRegionsOneCell +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/StarOrEmptyCaseRule/SimpleStarOrEmpty b/src/test/resources/puzzles/starbattle/rules/StarOrEmptyCaseRule/SimpleStarOrEmpty deleted file mode 100644 index 4d065b28f..000000000 --- a/src/test/resources/puzzles/starbattle/rules/StarOrEmptyCaseRule/SimpleStarOrEmpty +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar b/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar deleted file mode 100644 index a22f988df..000000000 --- a/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CenterStar +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CornerStar b/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CornerStar deleted file mode 100644 index 50558d4c4..000000000 --- a/src/test/resources/puzzles/starbattle/rules/SurroundStarDirectRule/CornerStar +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Column b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Column deleted file mode 100644 index 1d1004b8b..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Column +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/FalseContradiction b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/FalseContradiction deleted file mode 100644 index 0c377a58b..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/FalseContradiction +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/NotEnoughSpace b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/NotEnoughSpace deleted file mode 100644 index 9280cefdd..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/NotEnoughSpace +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Region b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Region deleted file mode 100644 index 2594f46e5..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Region +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Row b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Row deleted file mode 100644 index 67c36c5e8..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/Row +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarColumn b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarColumn deleted file mode 100644 index d781b3092..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarColumn +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarFalseContradiction b/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarFalseContradiction deleted file mode 100644 index 5f1d2753f..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooFewStarsContradictionRule/TwoStarFalseContradiction +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/ColumnOverloaded b/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/ColumnOverloaded deleted file mode 100644 index 4e7170b3e..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/ColumnOverloaded +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Correct b/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Correct deleted file mode 100644 index 15921e601..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Correct +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Region Overloaded Visualized-01.png b/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Region Overloaded Visualized-01.png deleted file mode 100644 index bfe24d1a4..000000000 Binary files a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/Region Overloaded Visualized-01.png and /dev/null differ diff --git a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RegionOverloaded b/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RegionOverloaded deleted file mode 100644 index bcf4a679a..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RegionOverloaded +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RowOverloaded b/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RowOverloaded deleted file mode 100644 index fdf1adc11..000000000 --- a/src/test/resources/puzzles/starbattle/rules/TooManyStarsContradictionRule/RowOverloaded +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -