diff --git a/.github/workflows/java-autoformat.yml b/.github/workflows/java-autoformat.yml index 7aa2487cb..116332804 100644 --- a/.github/workflows/java-autoformat.yml +++ b/.github/workflows/java-autoformat.yml @@ -2,8 +2,10 @@ name: Java Code Auto Format on: pull_request jobs: - format: - if: github.event.pull_request.head.repo.full_name == github.repository + format_dev: + if: | + github.event.pull_request.head.ref == 'dev' && + github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest steps: - name: Checkout code @@ -15,7 +17,6 @@ jobs: uses: actions/setup-java@v1 with: java-version: 21 - distribution: temurin - name: Grant execute permission for gradlew run: chmod +x gradlew @@ -28,7 +29,58 @@ jobs: - name: Check for modified files id: git-check - run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT + run: echo "modified=$(if [[ -n $(git status -s) ]]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT + + - name: Create temporary branch and pull request + if: steps.git-check.outputs.modified == 'true' + run: | + git config --global user.name 'Bram van Heuveln' + git config --global user.email 'bram28@users.noreply.github.com' + git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} + branch_name="auto-format-code-$(date +%s)" + git checkout -b $branch_name + ./gradlew :spotlessApply + git add . + git commit -am "Automated Java code formatting changes" + git push --set-upstream origin $branch_name + gh pr create -B dev -H $branch_name --title 'Automated Java code formatting changes' --body 'This pull request contains automated code formatting changes.' --reviewer ${{ github.actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Must approve auto-format pull request + if: steps.git-check.outputs.modified == 'true' + run: | + echo "Please review and approve the appropriate auto-format-code pull request." + exit 1 + + format_pull_request_to_dev: + if: | + github.event.pull_request.base.ref == 'dev' && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v1 + with: + ref: ${{ github.head_ref }} + + - name: Set up JDK 21 + uses: actions/setup-java@v1 + with: + java-version: 21 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build -x test + + - name: Run spotless + run: ./gradlew :spotlessApply + + - name: Check for modified files + id: git-check + run: echo "modified=$(if [[ -n $(git status -s) ]]; then echo "true"; else echo "false"; fi)" >> $GITHUB_OUTPUT - name: Push changes if: steps.git-check.outputs.modified == 'true' @@ -37,4 +89,5 @@ jobs: git config --global user.email 'bram28@users.noreply.github.com' git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} git add . - git diff --cached --exit-code || git commit -am "Automated Java code formatting changes" && git push \ No newline at end of file + git commit -am "Automated Java code formatting changes" + git push diff --git a/src/main/java/edu/rpi/legup/history/AutoCaseRuleCommand.java b/src/main/java/edu/rpi/legup/history/AutoCaseRuleCommand.java index 54e33756a..97192e145 100644 --- a/src/main/java/edu/rpi/legup/history/AutoCaseRuleCommand.java +++ b/src/main/java/edu/rpi/legup/history/AutoCaseRuleCommand.java @@ -23,8 +23,6 @@ public class AutoCaseRuleCommand extends PuzzleCommand { private List caseTrans; - private static final int MAX_CASES = 10; - /** * AutoCaseRuleCommand Constructor creates a command for validating a case rule * @@ -118,9 +116,14 @@ public String getErrorString() { return "The selection must produce at least one case"; } - if (caseRule.getCases(caseBoard.getBaseBoard(), elementView.getPuzzleElement()).size() - > MAX_CASES) { - return "The selection can produce a max of " + MAX_CASES + " cases"; + int numberOfCaseRules = + caseRule.getCases(caseBoard.getBaseBoard(), elementView.getPuzzleElement()).size(); + System.out.println("Number of cases:" + numberOfCaseRules); + if (numberOfCaseRules > caseRule.MAX_CASES) { + return "The selection can produce a max of " + caseRule.MAX_CASES + " cases"; + } + if (numberOfCaseRules < caseRule.MIN_CASES) { + return "The selection must produce a minimum of " + caseRule.MIN_CASES + " cases"; } return null; diff --git a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java index e32cb55c8..c41d5e1b2 100644 --- a/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java +++ b/src/main/java/edu/rpi/legup/model/gameboard/GridRegion.java @@ -1,53 +1,55 @@ -package edu.rpi.legup.model.gameboard; - -import java.util.ArrayList; -import java.util.List; - -public abstract class GridRegion { - - protected List regionCells; - - /** - * Region Constructor - */ - public GridRegion() { - this.regionCells = new ArrayList<>(); - } - - /** - * Adds the cell to the region - * @param cell cell to be added to the region - */ - public void addCell(T cell) { - regionCells.add(cell); - } - - /** - * Removes the cell from the region - * @param cell cell to be remove from the region - */ - public void removeCell(T cell) { - regionCells.remove(cell); - } - - /** - * Returns the list of cells in the region - * @return list of cells in region - */ - public List getCells() { - return regionCells; - } - - /** - * Returns the number of cells in the region - * @return number of cells in the region - */ - public int getSize(){ - return regionCells.size(); - } - - /* - public void colorRegion(){} - */ - -} +package edu.rpi.legup.model.gameboard; + +import java.util.ArrayList; +import java.util.List; + +public abstract class GridRegion { + + protected List regionCells; + + /** Region Constructor */ + public GridRegion() { + this.regionCells = new ArrayList<>(); + } + + /** + * Adds the cell to the region + * + * @param cell cell to be added to the region + */ + public void addCell(T cell) { + regionCells.add(cell); + } + + /** + * Removes the cell from the region + * + * @param cell cell to be remove from the region + */ + public void removeCell(T cell) { + regionCells.remove(cell); + } + + /** + * Returns the list of cells in the region + * + * @return list of cells in region + */ + public List getCells() { + return regionCells; + } + + /** + * Returns the number of cells in the region + * + * @return number of cells in the region + */ + public int getSize() { + return regionCells.size(); + } + + /* + public void colorRegion(){} + */ + +} diff --git a/src/main/java/edu/rpi/legup/model/rules/CaseRule.java b/src/main/java/edu/rpi/legup/model/rules/CaseRule.java index e87896fcc..ab2cc8f0d 100644 --- a/src/main/java/edu/rpi/legup/model/rules/CaseRule.java +++ b/src/main/java/edu/rpi/legup/model/rules/CaseRule.java @@ -14,6 +14,8 @@ public abstract class CaseRule extends Rule { private final String INVALID_USE_MESSAGE; + public int MAX_CASES; + public int MIN_CASES; /** * CaseRule Constructor creates a new case rule. @@ -27,6 +29,8 @@ public CaseRule(String ruleID, String ruleName, String description, String image super(ruleID, ruleName, description, imageName); this.ruleType = CASE; this.INVALID_USE_MESSAGE = "Invalid use of the case rule " + this.ruleName; + this.MAX_CASES = 10; + this.MIN_CASES = 1; // By default, this will not actually have any effect } /** @@ -68,7 +72,6 @@ public String checkRule(TreeTransition transition) { return "All children nodes must be justified with the same case rule."; } } - String check = checkRuleRaw(transition); // Mark transition and new data as valid or not diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java index ac656721d..490122874 100644 --- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java @@ -188,8 +188,28 @@ public String checkRuleRaw(TreeTransition transition) { for (LightUpCell c : spots) { ArrayList cases = getCases(parent.getBoard(), c); - // We will allow case rules to have only one option - if (cases.size() == childTransitions.size() && cases.size() >= 1) { + // Note: we will allow case rules to have only one option + + // Some error checking to make sure that weird stuff doesn't happen + // if this case rule is incorrectly used to justify changes on the + // puzzle board + if (cases.size() == childTransitions.size() && cases.size() == 1) { + TreeTransition childTransition = childTransitions.get(0); + + // If there is only 1 case, then this case rule should function no + // differently than the Finish With Bulbs Direct Rule + FinishWithBulbsDirectRule finishWithBulbs = new FinishWithBulbsDirectRule(); + childTransition.setRule(finishWithBulbs); + boolean isCorrect = childTransition.isCorrect(); + + // Changes the transition back to this case rule + childTransition.setRule(this); + + if (isCorrect) { + return null; + } + return super.getInvalidUseOfRuleMessage(); + } else if (cases.size() == childTransitions.size() && cases.size() > 1) { boolean foundSpot = true; for (TreeTransition childTrans : childTransitions) { LightUpBoard actCase = (LightUpBoard) childTrans.getBoard(); diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java index fe1ffcf91..ac0ab6df6 100644 --- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/BlackOrWhiteCaseRule.java @@ -19,6 +19,7 @@ public BlackOrWhiteCaseRule() { "Black or White", "Each blank cell is either black or white.", "edu/rpi/legup/images/nurikabe/cases/BlackOrWhite.png"); + this.MAX_CASES = 2; } /** diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java new file mode 100644 index 000000000..4901cfa6f --- /dev/null +++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java @@ -0,0 +1,249 @@ +package edu.rpi.legup.puzzle.nurikabe.rules; + +import edu.rpi.legup.model.gameboard.Board; +import edu.rpi.legup.model.gameboard.CaseBoard; +import edu.rpi.legup.model.gameboard.PuzzleElement; +import edu.rpi.legup.model.rules.CaseRule; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.nurikabe.NurikabeBoard; +import edu.rpi.legup.puzzle.nurikabe.NurikabeCell; +import edu.rpi.legup.puzzle.nurikabe.NurikabeType; +import edu.rpi.legup.puzzle.nurikabe.NurikabeUtilities; +import edu.rpi.legup.utility.DisjointSets; +import java.awt.*; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class FinishRoomCaseRule extends CaseRule { + private int legitCases = + 0; // placeholder for amount of cases originally generated in case user tries to delete + + // cases + + public FinishRoomCaseRule() { + super( + "NURI-CASE-0002", + "Finish Room", + "Room can be finished in up to five ways", + "edu/rpi/legup/images/nurikabe/cases/FinishRoom.png"); + this.MAX_CASES = 5; + this.MIN_CASES = 2; + } + + /** + * Checks whether the {@link TreeTransition} logically follows from the parent node using this + * rule. This method is the one that should overridden in child classes. + * + * @param transition transition to check + * @return null if the child node logically follow from the parent node, otherwise error message + */ + @Override + public String checkRuleRaw(TreeTransition transition) { + NurikabeBoard destBoardState = (NurikabeBoard) transition.getBoard(); + List childTransitions = transition.getParents().get(0).getChildren(); + if (childTransitions.size() > 5) { + return super.getInvalidUseOfRuleMessage() + + ": This case rule must have 5 or less children."; + } + if (childTransitions.size() < 2) { + return super.getInvalidUseOfRuleMessage() + + ": This case rule must have 2 or more children."; + } + if (childTransitions.size() != legitCases) { + return super.getInvalidUseOfRuleMessage() + + ": Cases can not be removed from the branch."; + } // stops user from deleting 1 or mose generated cases and still having path show as green + Set locations = new HashSet<>(); + for (TreeTransition t1 : childTransitions) { + locations.add( + ((NurikabeCell) t1.getBoard().getModifiedData().iterator().next()) + .getLocation()); // loop see if matches + if (t1.getBoard().getModifiedData().size() != 1) { + return super.getInvalidUseOfRuleMessage() + + ": This case rule must have 1 modified cell for each case."; + } + for (Point loc : locations) { + for (Point loc2 : locations) { + if (!(loc.equals(loc2)) && (loc.x == loc2.x) && (loc.y == loc2.y)) { + return super.getInvalidUseOfRuleMessage() + + ": This case rule must alter a different cell for each case."; + } + } + } + } + + return null; + } + + @Override + public CaseBoard getCaseBoard(Board board) { + NurikabeBoard nurikabeBoard = (NurikabeBoard) board.copy(); + CaseBoard caseBoard = new CaseBoard(nurikabeBoard, this); + DisjointSets regions = NurikabeUtilities.getNurikabeRegions(nurikabeBoard); + nurikabeBoard.setModifiable(false); + + for (PuzzleElement element : + nurikabeBoard.getPuzzleElements()) { // loops all puzzle elements + if (((NurikabeCell) element).getType() + == NurikabeType.NUMBER) { // if the tile is a white number block + Set disRow = + regions.getSet( + ((NurikabeCell) element)); // store the row of the white region + boolean only = + true; // placeholder boolean of if the element being tested is the only + // number block in the room or not + for (NurikabeCell d : disRow) { // loops through tiles in the room + if ((d.getType() == NurikabeType.NUMBER) + && !(d.getData() + .equals( + ((NurikabeCell) element) + .getData()))) { // if found another number tile + // and it's data is different + // than the element we're + // working with + only = false; // set only to false + } + } + if (disRow.size() + 1 == ((NurikabeCell) element).getData() + && only) { // if size of region is 1 less than the number block and the + // number block is only number block in the region + caseBoard.addPickableElement(element); // add that room as a pickable element + } + } + } + return caseBoard; + } + + /** + * Gets the possible cases at a specific location based on this case rule + * + * @param board the current board state + * @param puzzleElement equivalent puzzleElement + * @return a list of elements the specified could be + */ + @Override + public ArrayList getCases(Board board, PuzzleElement puzzleElement) { + ArrayList cases = new ArrayList<>(); // makes array list of cases + NurikabeBoard nuriBoard = (NurikabeBoard) board.copy(); // nurikabe board to edit + NurikabeCell numbaCell = + nuriBoard.getCell( + ((NurikabeCell) puzzleElement).getLocation().x, + ((NurikabeCell) puzzleElement) + .getLocation() + .y); // number cell whose room we want to fill + int filledRoomSize = numbaCell.getData(); // size of room we want afterward + Set locations = + new HashSet<>(); // locations where white space is added to finish room + Point left = new Point(-1, 0); + Point right = new Point(1, 0); + Point bot = new Point(0, -1); + Point top = new Point(0, 1); + Set directions = new HashSet<>(); + directions.add(left); + directions.add(right); + directions.add(top); + directions.add(bot); + Set checkedPoints = + new HashSet<>(); // add all into checked points and continue at start of loop if + // inside + DisjointSets regions = + NurikabeUtilities.getNurikabeRegions(nuriBoard); // gathers regions + Set disRow = regions.getSet(numbaCell); // set of white spaces + for (NurikabeCell d : disRow) { // loops through white spaces + if (cases.size() >= 6) { // no need to check this many cases + // throw new IllegalStateException("Too many cases"); + continue; // crash/runtime protection + } + for (Point direction : directions) { + if (cases.size() >= 6) { // no need to check this many cases + // throw new IllegalStateException("Too many cases"); + continue; // crash/runtime protection + } + if (!((nuriBoard.getWidth() > (d.getLocation().x + direction.x) + && (nuriBoard.getHeight() > d.getLocation().y + direction.y) + && (d.getLocation().x + direction.x >= 0) + && (d.getLocation().y + direction.y >= 0)))) { + continue; // if next location check would be outside of grid then continue + } + NurikabeCell curr = + nuriBoard.getCell( + d.getLocation().x + direction.x, d.getLocation().y + direction.y); + if (checkedPoints.contains(curr.getLocation())) { + continue; // if we already checked whether or not making this tile white would + // complete the room then continue + } + checkedPoints.add( + curr.getLocation()); // adds location to checkedPoints so we don't check + // it again and accidentally add + if (curr.getType() + == NurikabeType + .UNKNOWN) { // found adjacent space to region that is currently + // unknown + curr.setData( + NurikabeType.WHITE.toValue()); // changes adjacent cell color to white + nuriBoard.addModifiedData(curr); // adds modified before check + regions = NurikabeUtilities.getNurikabeRegions(nuriBoard); // update regions + Set disCreatedRow = + regions.getSet( + curr); // gets set of created row with new white cell added + if (disCreatedRow.size() + == filledRoomSize) { // If adding white fills the room to exact size of + // number block and doesn't connect with another + // room + Point here = curr.getLocation(); // gets current location of new white tile + // that fills room + boolean alreadyIn = + false; // sets whether or not the tile has already been added to + // false + for (Point p : + locations) { // loops through locations of previously added tiles + if (p == here) { // if point is already in + alreadyIn = true; // change already in to true + break; + } + } + if (!alreadyIn) { // if point wasn't already in + Board casey = + nuriBoard.copy(); // copy the current board with white tile + // changed + PuzzleElement datacasey = + curr; // gets changed white tile as a puzzle element + datacasey.setData( + NurikabeType.WHITE + .toValue()); // ensure set to white, probably redundant + casey.addModifiedData(datacasey); // ensure confirmed white change + regions = + NurikabeUtilities.getNurikabeRegions( + nuriBoard); // update regions + cases.add(casey); // add this case to list of cases + locations.add( + here); // add location of new white tile to list of locations so + // that we don't accidentally add it again later + } + } + curr.setData(NurikabeType.UNKNOWN.toValue()); // set cell type back to unknown + nuriBoard.addModifiedData(curr); // confirms change back to unknown + regions = NurikabeUtilities.getNurikabeRegions(nuriBoard); // updates regions + } + } + legitCases = cases.size(); + } + return cases; + } + + /** + * 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) { + return null; + } +} diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/nurikabe_reference_sheet.txt b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/nurikabe_reference_sheet.txt index 6a6e6bc1f..596de7819 100644 --- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/nurikabe_reference_sheet.txt +++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/nurikabe_reference_sheet.txt @@ -16,4 +16,5 @@ NURI-CONT-0005 : NoNumberContradictionRule NURI-CONT-0006 : TooFewSpacesContradictionRule NURI-CONT-0007 : TooManySpacesContradictionRule -NURI-CASE-0001 : BlackOrWhiteCaseRule \ No newline at end of file +NURI-CASE-0001 : BlackOrWhiteCaseRule +NURI-CASE-0002 : FinishRoomCaseRule \ No newline at end of file diff --git a/src/main/resources/edu/rpi/legup/images/nurikabe/cases/FinishRoom.png b/src/main/resources/edu/rpi/legup/images/nurikabe/cases/FinishRoom.png new file mode 100644 index 000000000..207d4c820 Binary files /dev/null and b/src/main/resources/edu/rpi/legup/images/nurikabe/cases/FinishRoom.png differ diff --git a/src/test/java/legup/TestRunner.java b/src/test/java/legup/TestRunner.java index 40cc5fa6c..8661f0e69 100644 --- a/src/test/java/legup/TestRunner.java +++ b/src/test/java/legup/TestRunner.java @@ -18,7 +18,7 @@ public static void main(String[] args) { Result result2 = JUnitCore.runClasses(FinishWithShipsDirectRuleTests.class); printTestResults(result2); - // Lightup Tests + // LightUp Tests Result result3 = JUnitCore.runClasses(BulbsInPathContradictionRuleTest.class); printTestResults(result3); Result result4 = JUnitCore.runClasses(CannotLightACellContradictionRuleTest.class); @@ -29,68 +29,70 @@ public static void main(String[] args) { printTestResults(result6); Result result7 = JUnitCore.runClasses(FinishWithBulbsDirectRuleTest.class); printTestResults(result7); - Result result8 = JUnitCore.runClasses(LightOrEmptyCaseRuleTest.class); + Result result8 = JUnitCore.runClasses(FinishWithEmptyDirectRuleTest.class); printTestResults(result8); - Result result9 = JUnitCore.runClasses(MustLightDirectRuleTest.class); + Result result9 = JUnitCore.runClasses(LightOrEmptyCaseRuleTest.class); printTestResults(result9); - Result result10 = JUnitCore.runClasses(SatisfyNumberCaseRuleTest.class); + Result result10 = JUnitCore.runClasses(MustLightDirectRuleTest.class); printTestResults(result10); - Result result11 = JUnitCore.runClasses(TooFewBulbsContradictionRuleTest.class); + Result result11 = JUnitCore.runClasses(SatisfyNumberCaseRuleTest.class); printTestResults(result11); - Result result12 = JUnitCore.runClasses(TooManyBulbsContradictionRuleTest.class); + Result result12 = JUnitCore.runClasses(TooFewBulbsContradictionRuleTest.class); printTestResults(result12); + Result result13 = JUnitCore.runClasses(TooManyBulbsContradictionRuleTest.class); + printTestResults(result13); // nurikabe tests - Result result13 = JUnitCore.runClasses(BlackBetweenRegionsDirectRuleTest.class); - printTestResults(result13); - Result result14 = JUnitCore.runClasses(BlackBottleNeckDirectRuleTest.class); + Result result14 = JUnitCore.runClasses(BlackBetweenRegionsDirectRuleTest.class); printTestResults(result14); - Result result15 = JUnitCore.runClasses(BlackOrWhiteCaseRuleTest.class); + Result result15 = JUnitCore.runClasses(BlackBottleNeckDirectRuleTest.class); printTestResults(result15); - Result result16 = JUnitCore.runClasses(BlackSquareContradictionRuleTest.class); + Result result16 = JUnitCore.runClasses(BlackOrWhiteCaseRuleTest.class); printTestResults(result16); - Result result17 = JUnitCore.runClasses(CornerBlackDirectRuleTest.class); + Result result17 = JUnitCore.runClasses(BlackSquareContradictionRuleTest.class); printTestResults(result17); - Result result18 = JUnitCore.runClasses(FillinBlackDirectRuleTest.class); + Result result18 = JUnitCore.runClasses(CornerBlackDirectRuleTest.class); printTestResults(result18); - Result result19 = JUnitCore.runClasses(FillinWhiteDirectRuleTest.class); + Result result19 = JUnitCore.runClasses(FillinBlackDirectRuleTest.class); printTestResults(result19); - Result result20 = JUnitCore.runClasses(IsolateBlackContradictionRuleTest.class); + Result result20 = JUnitCore.runClasses(FillinWhiteDirectRuleTest.class); printTestResults(result20); - Result result21 = JUnitCore.runClasses(MultipleNumbersContradictionRuleTest.class); + Result result21 = JUnitCore.runClasses(IsolateBlackContradictionRuleTest.class); printTestResults(result21); - Result result22 = JUnitCore.runClasses(NoNumbersContradictionRuleTest.class); + Result result22 = JUnitCore.runClasses(MultipleNumbersContradictionRuleTest.class); printTestResults(result22); - Result result23 = JUnitCore.runClasses(PreventBlackSquareDirectRuleTest.class); + Result result23 = JUnitCore.runClasses(NoNumbersContradictionRuleTest.class); printTestResults(result23); - Result result24 = JUnitCore.runClasses(SurroundRegionDirectRuleTest.class); + Result result24 = JUnitCore.runClasses(PreventBlackSquareDirectRuleTest.class); printTestResults(result24); - Result result25 = JUnitCore.runClasses(TooFewSpacesContradictionRuleTest.class); + Result result25 = JUnitCore.runClasses(SurroundRegionDirectRuleTest.class); printTestResults(result25); - Result result26 = JUnitCore.runClasses(TooManySpacesContradictionRuleTest.class); + Result result26 = JUnitCore.runClasses(TooFewSpacesContradictionRuleTest.class); printTestResults(result26); - Result result27 = JUnitCore.runClasses(WhiteBottleNeckDirectRuleTest.class); + Result result27 = JUnitCore.runClasses(TooManySpacesContradictionRuleTest.class); printTestResults(result27); + Result result28 = JUnitCore.runClasses(WhiteBottleNeckDirectRuleTest.class); + printTestResults(result28); // Treetent - Result result28 = JUnitCore.runClasses(EmptyFieldDirectRuleTest.class); - printTestResults(result28); - Result result29 = JUnitCore.runClasses(FinishWithGrassDirectRuleTest.class); + Result result29 = JUnitCore.runClasses(EmptyFieldDirectRuleTest.class); printTestResults(result29); - Result result30 = JUnitCore.runClasses(FinishWithTentsDirectRuleTest.class); + Result result30 = JUnitCore.runClasses(FinishWithGrassDirectRuleTest.class); printTestResults(result30); - Result result31 = JUnitCore.runClasses(LastCampingSpotDirectRuleTest.class); + Result result31 = JUnitCore.runClasses(FinishWithTentsDirectRuleTest.class); printTestResults(result31); - Result result32 = JUnitCore.runClasses(NoTentForTreeContradictionRuleTest.class); + Result result32 = JUnitCore.runClasses(LastCampingSpotDirectRuleTest.class); printTestResults(result32); - Result result33 = JUnitCore.runClasses(NoTreeForTentContradictionRuleTest.class); + Result result33 = JUnitCore.runClasses(NoTentForTreeContradictionRuleTest.class); printTestResults(result33); - Result result34 = JUnitCore.runClasses(SurroundTentWithGrassDirectRuleTest.class); + Result result34 = JUnitCore.runClasses(NoTreeForTentContradictionRuleTest.class); printTestResults(result34); - Result result35 = JUnitCore.runClasses(TreeForTentDirectRuleTest.class); + Result result35 = JUnitCore.runClasses(SurroundTentWithGrassDirectRuleTest.class); printTestResults(result35); - Result result36 = JUnitCore.runClasses(TentOrGrassCaseRuleTest.class); + Result result36 = JUnitCore.runClasses(TreeForTentDirectRuleTest.class); printTestResults(result36); + Result result37 = JUnitCore.runClasses(TentOrGrassCaseRuleTest.class); + printTestResults(result37); } private static void printTestResults(Result result) { diff --git a/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java b/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java new file mode 100644 index 000000000..079641ee7 --- /dev/null +++ b/src/test/java/puzzles/lightup/rules/FinishWithEmptyDirectRuleTest.java @@ -0,0 +1,105 @@ +package puzzles.lightup.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.lightup.LightUp; +import edu.rpi.legup.puzzle.lightup.LightUpBoard; +import edu.rpi.legup.puzzle.lightup.LightUpCell; +import edu.rpi.legup.puzzle.lightup.LightUpCellType; +import edu.rpi.legup.puzzle.lightup.rules.FinishWithEmptyDirectRule; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class FinishWithEmptyDirectRuleTest { + private static final FinishWithEmptyDirectRule RULE = new FinishWithEmptyDirectRule(); + private static LightUp lightUp; + + @BeforeClass + public static void setUp() { + lightUp = new LightUp(); + } + + @Test + public void FinishEmptyTestWithOne() throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithOne", lightUp); + TreeNode rootNode = lightUp.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + // get board state + LightUpBoard board = (LightUpBoard) transition.getBoard(); + // The board has a "1" clue at (1,1) with a bulb one space above at (1,0); + + // change the board's cells considering the FinishWithEmpty rule to empty + LightUpCell cell1 = board.getCell(0, 1); // left + cell1.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell1); + + LightUpCell cell2 = board.getCell(2, 1); // right + cell2.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell2); + + LightUpCell cell3 = board.getCell(1, 2); // below + cell3.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell3); + + // confirm there is a logical following of the FinishWithEmpty rule + Assert.assertNull(RULE.checkRule(transition)); + + // check every square except the top center (2,0) + LightUpCell c; + for (int i = 0; i < board.getHeight(); i++) { + for (int j = 0; j < board.getWidth(); j++) { + c = board.getCell(j, i); + if ((i == 1 && j == 0) || (i == 1 && j == 2) || (i == 2 && j == 1)) { + // logically follows + Assert.assertNull(RULE.checkRuleAt(transition, c)); + } else { + // does not use the rule to logically follow + Assert.assertNotNull(RULE.checkRuleAt(transition, c)); + } + } + } + } + + @Test + public void FinishEmptyTestWithThree() throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree", + lightUp); + TreeNode rootNode = lightUp.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + // get board state + LightUpBoard board = (LightUpBoard) transition.getBoard(); + // The board has a "3" clue at (1,1) with a bulbs at (0,1), (2,1), and (1,2) + + // change the board's cells considering the FinishWithBulbs rule to empty + LightUpCell cell1 = board.getCell(1, 0); + cell1.setData(LightUpCellType.EMPTY.value); + board.addModifiedData(cell1); + + // confirm there is a logical following of the FinishWithBulbs rule + Assert.assertNull(RULE.checkRule(transition)); + + // check every square for logical following + LightUpCell c; + for (int i = 0; i < board.getHeight(); i++) { + for (int j = 0; j < board.getWidth(); j++) { + c = board.getCell(j, i); + if (i == 0 && j == 1) { + // logically follows + Assert.assertNull(RULE.checkRuleAt(transition, c)); + } else { + // does not use the rule to logically follow + Assert.assertNotNull(RULE.checkRuleAt(transition, c)); + } + } + } + } +} diff --git a/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java b/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java new file mode 100644 index 000000000..5f5b6d35a --- /dev/null +++ b/src/test/java/puzzles/nurikabe/rules/FinishRoomCaseRuleTest.java @@ -0,0 +1,114 @@ +package puzzles.nurikabe.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.*; +import edu.rpi.legup.puzzle.nurikabe.rules.FinishRoomCaseRule; +import edu.rpi.legup.save.InvalidFileFormatException; +import edu.rpi.legup.utility.DisjointSets; +import java.awt.*; +import java.util.ArrayList; +import java.util.Set; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class FinishRoomCaseRuleTest { + + private static final FinishRoomCaseRule RULE = new FinishRoomCaseRule(); + private static Nurikabe nurikabe; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + nurikabe = new Nurikabe(); + } + + /** + * Tests the Finish Room case rule by ensuring that it results in 5 or less children, that + * contain a modified cell that is white + */ + @Test + public void FinishRoomCaseRule_FinishRoomCaseRuleBaseTest() throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/nurikabe/rules/FinishRoomCaseRule/FinishRoomCaseRuleBase", nurikabe); + TreeNode rootNode = nurikabe.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + NurikabeBoard board = (NurikabeBoard) transition.getBoard(); + NurikabeCell cell = board.getCell(6, 4); + ArrayList cases = RULE.getCases(board, cell); + Assert.assertEquals(2, cases.size()); + + NurikabeBoard caseBoard = (NurikabeBoard) cases.get(0); + NurikabeBoard caseBoard2 = (NurikabeBoard) cases.get(1); + + NurikabeType board1Type = caseBoard.getCell(5, 5).getType(); + NurikabeType board2Type = caseBoard2.getCell(6, 6).getType(); + + Assert.assertTrue( + (board1Type.equals(NurikabeType.WHITE) && board2Type.equals(NurikabeType.WHITE))); + + Assert.assertEquals(caseBoard.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + DisjointSets regions = + NurikabeUtilities.getNurikabeRegions(caseBoard); // gathers regions + Set disRow = regions.getSet(caseBoard.getCell(5, 5)); + Assert.assertEquals(disRow.size(), 3); + + DisjointSets regions2 = + NurikabeUtilities.getNurikabeRegions(caseBoard2); // gathers regions + Set disRow2 = regions2.getSet(caseBoard2.getCell(6, 6)); + Assert.assertEquals(disRow2.size(), 3); + + for (int i = 0; i < caseBoard.getHeight(); i++) { + for (int k = 0; k < caseBoard.getWidth(); k++) { + Point point = new Point(k, i); + if (point.equals(caseBoard.getCell(k, i).getLocation())) { + continue; + } + Assert.assertTrue( + caseBoard.getCell(k, i).equals(caseBoard2.getCell(k, i)) + || caseBoard2.getCell(k, i).equals(caseBoard2.getCell(k, i))); + } + } + + NurikabeCell cell2 = board.getCell(4, 2); + ArrayList cases2 = RULE.getCases(board, cell2); + + Assert.assertEquals(6, cases2.size()); // correctly stops generating possible cases after + // more than 5 (the max) is found. Would have generated 8 cases + // FinishRoomCaseRule finny = new FinishRoomCaseRule(); + // finny.checkRuleRaw(); + // "Invalid use of the case rule FinishRoom: This case rule must have 5 or less children." + + // getErrorString in auto case rule + // should display "The selection can produce a max of 5 cases." + // AutoCaseRuleCommand autoCaseRuleCommand = new AutoCaseRuleCommand(elementView, selection, + // caseBoard.getCaseRule(), caseBoard, e); + + // NurikabeBoard caseyBoard = (NurikabeBoard) cases2.get(0); + // NurikabeBoard caseyBoard2 = (NurikabeBoard) cases2.get(1); + // NurikabeBoard caseyBoard3 = (NurikabeBoard) cases2.get(2); + // NurikabeBoard caseyBoard4 = (NurikabeBoard) cases2.get(3); + // NurikabeBoard caseyBoard5 = (NurikabeBoard) cases2.get(4); + // NurikabeBoard caseyBoard6 = (NurikabeBoard) cases2.get(5); + // NurikabeBoard caseyBoard7 = (NurikabeBoard) cases2.get(6); + // NurikabeBoard caseyBoard8 = (NurikabeBoard) cases2.get(7); + // + // NurikabeType boardy1Type = caseyBoard.getCell(5,5).getType(); + // NurikabeType boardy2Type = caseyBoard2.getCell(6,6).getType(); + // NurikabeType boardy3Type = caseyBoard.getCell(5,5).getType(); + // NurikabeType boardy4Type = caseyBoard2.getCell(6,6).getType(); + // NurikabeType boardy5Type = caseyBoard.getCell(5,5).getType(); + // NurikabeType boardy6Type = caseyBoard2.getCell(6,6).getType(); + // NurikabeType boardy7Type = caseyBoard.getCell(5,5).getType(); + // NurikabeType boardy8Type = caseyBoard2.getCell(6,6).getType(); + + } +} diff --git a/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java b/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java deleted file mode 100644 index 3054a99d9..000000000 --- a/src/test/java/puzzles/shorttruthtable/ShortTruthTableImporterTest.java +++ /dev/null @@ -1,10 +0,0 @@ -// package puzzles.shorttruthtable; - -// class ShortTruthTableImporterTest{ - -// @Test -// public void testImport(){ - -// } - -// } diff --git a/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java b/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java deleted file mode 100644 index 91a45933a..000000000 --- a/src/test/java/puzzles/shorttruthtable/ShortTruthTableStatementTest.java +++ /dev/null @@ -1,15 +0,0 @@ -package puzzles.shorttruthtable; - -// import org.junit.Test; -// import static org.junit.Assert.assertEquals; - -// class ShortTruthTableStatementTest{ - -// @Test -// public void testCreateStatement(){ -// ShortTruthTableStatement statement = new ShortTruthTableStatement("a^b"); - -// assertEquals(statement.getLength(), 3); -// } - -// } diff --git a/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java new file mode 100644 index 000000000..618c03926 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/AndContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleAnd; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AndContradictionRuleTest { + + private static final ContradictionRuleAnd RULE = new ContradictionRuleAnd(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A ^ B where ^ is true + * + *

Asserts that this is a valid application of the rule if and only if A or B are set to + * false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueAndTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AndContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueAndTestHelper(path + first + "T" + second); + } + } + } + + private void trueAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE + || b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A ^ B where ^ is false + * + *

Asserts that this is a valid application of the rule if and only if A or B (or both) are + * set to true. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseAndTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AndContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseAndTestHelper(path + first + "F" + second); + } + } + } + + private void falseAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE + && b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A ^ B where ^ is unknown + * + *

Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownAndTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from And Introduction + String path = "puzzles/shorttruthtable/rules/AndIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownAndTestHelper(path + first + "U" + second); + } + } + } + + private void unknownAndTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java new file mode 100644 index 000000000..a87035f42 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/AtomicContradictionRuleTest.java @@ -0,0 +1,66 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleAtomic; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class AtomicContradictionRuleTest { + + private static final ContradictionRuleAtomic RULE = new ContradictionRuleAtomic(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given two statements: A, A + * + *

Asserts that this is a valid application of the rule if and only if both A and B are not + * unknown and different. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void mismatchTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/AtomicContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + mismatchHelper(path + first + second); + } + } + } + + private void mismatchHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(0, 2); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() != b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java new file mode 100644 index 000000000..527cba652 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalCaseRuleTest.java @@ -0,0 +1,191 @@ +package puzzles.shorttruthtable.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.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleBiconditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import java.util.ArrayList; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class BiconditionalCaseRuleTest { + + private static final CaseRuleBiconditional RULE = new CaseRuleBiconditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + private void trueBiconditionalTest( + String fileName, int biconditionalX, int biconditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(biconditionalX, biconditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A and B are equal and either true or false in both branches + Assert.assertEquals(board1A, board1B); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.TRUE) + && board1B.equals(ShortTruthTableCellType.TRUE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board1B.equals(ShortTruthTableCellType.FALSE))); + + Assert.assertNotEquals(board1B, board2B); + Assert.assertTrue( + (board2A.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.TRUE)) + || (board2A.equals(ShortTruthTableCellType.FALSE) + && board2B.equals(ShortTruthTableCellType.FALSE))); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i < caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that two branches + * are created: one where A is false and one where B is true. + */ + @Test + public void SimpleStatement1TrueTest() throws InvalidFileFormatException { + trueBiconditionalTest("TrueBiconditional", 1, 0, 0, 0, 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule by ensuring that + * two branches are created: one where ~ is false and one where ^ is true. + */ + @Test + public void ComplexStatement1TrueTest() throws InvalidFileFormatException { + trueBiconditionalTest("ComplexStatement1_True", 6, 0, 0, 0, 9, 0); + } + + private void falseBiconditionalTest( + String fileName, int biconditionalX, int biconditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/BiconditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(biconditionalX, biconditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A and B are not equal and are both either true or false in both branches + Assert.assertNotEquals(board1A, board1B); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.TRUE) + && board1B.equals(ShortTruthTableCellType.FALSE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board1B.equals(ShortTruthTableCellType.TRUE))); + + Assert.assertNotEquals(board2A, board2B); + Assert.assertTrue( + (board2A.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.FALSE)) + || (board2A.equals(ShortTruthTableCellType.FALSE) + && board2B.equals(ShortTruthTableCellType.TRUE))); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i < caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where -> is false, tests this case rule by ensuring that one branch + * is created where A is true and B is false. + */ + @Test + public void SimpleStatement1FalseTest() throws InvalidFileFormatException { + falseBiconditionalTest("FalseBiconditional", 1, 0, 0, 0, 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule by ensuring that one + * branch is created where ~ is true and ^ is false. + */ + @Test + public void ComplexStatement1FalseTest() throws InvalidFileFormatException { + falseBiconditionalTest("ComplexStatement1_False", 6, 0, 0, 0, 9, 0); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java new file mode 100644 index 000000000..af41a5b8c --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/BiconditionalContradictionRuleTest.java @@ -0,0 +1,134 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleBiconditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class BiconditionalContradictionRuleTest { + + private static final ContradictionRuleBiconditional RULE = new ContradictionRuleBiconditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A <-> B where <-> is true + * + *

Asserts that this is a valid application of the rule if and only if A and B are not + * unknown and A does not equal B + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueBiconditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/BiconditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueBiconditionalTestHelper(path + first + "T" + second); + } + } + } + + private void trueBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() != b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A <-> B where <-> is false + * + *

Asserts that this is a valid application of the rule if and only if A and B are not + * unknown and A equals B + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/BiconditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseBiconditionalTestHelper(path + first + "F" + second); + } + } + } + + private void falseBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() != ShortTruthTableCellType.UNKNOWN + && b.getType() != ShortTruthTableCellType.UNKNOWN + && a.getType() == b.getType()) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A <-> B where <-> is unknown + * + *

Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownBiconditionalTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Biconditional Introduction + String path = "puzzles/shorttruthtable/rules/BiconditionalIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownBiconditionalTestHelper(path + first + "U" + second); + } + } + } + + private void unknownBiconditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java new file mode 100644 index 000000000..891fd975d --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalCaseRuleTest.java @@ -0,0 +1,160 @@ +package puzzles.shorttruthtable.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.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.caserule.CaseRuleConditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import java.util.ArrayList; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ConditionalCaseRuleTest { + + private static final CaseRuleConditional RULE = new CaseRuleConditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + private void trueConditionalTest( + String fileName, int conditionalX, int conditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(conditionalX, conditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // Make sure there are two branches + Assert.assertEquals(2, cases.size()); + + ShortTruthTableBoard caseBoard1 = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType board1A = caseBoard1.getCell(aX, aY).getType(); + ShortTruthTableCellType board1B = caseBoard1.getCell(bX, bY).getType(); + + ShortTruthTableBoard caseBoard2 = (ShortTruthTableBoard) cases.get(1); + ShortTruthTableCellType board2A = caseBoard2.getCell(aX, aY).getType(); + ShortTruthTableCellType board2B = caseBoard2.getCell(bX, bY).getType(); + + // Assert that the corresponding cells for the different case rules do not + // match with each other + Assert.assertNotEquals(board1A, board2A); + Assert.assertNotEquals(board1B, board2B); + + // Assert that A is unknown in one board and false in the other + Assert.assertNotEquals(board1A, board2A); + Assert.assertTrue( + (board1A.equals(ShortTruthTableCellType.UNKNOWN) + && board2A.equals(ShortTruthTableCellType.FALSE)) + || (board1A.equals(ShortTruthTableCellType.FALSE) + && board2A.equals(ShortTruthTableCellType.UNKNOWN))); + + // Assert that B is unknown in one board and true in the other + Assert.assertNotEquals(board1B, board2B); + Assert.assertTrue( + (board1B.equals(ShortTruthTableCellType.UNKNOWN) + && board2B.equals(ShortTruthTableCellType.TRUE)) + || (board1B.equals(ShortTruthTableCellType.TRUE) + && board2B.equals(ShortTruthTableCellType.UNKNOWN))); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard1.getHeight(), caseBoard2.getHeight(), board.getHeight()); + Assert.assertEquals(caseBoard1.getWidth(), caseBoard2.getWidth(), board.getWidth()); + + // Verify that everywhere else on the board is unchanged + for (int i = 0; i < caseBoard1.getWidth(); i++) { + for (int j = 0; j < caseBoard1.getHeight(); j++) { + // Make sure not to check the two cells that should be different + if (!((i == aX && j == aY) || (i == bX && j == bY))) { + Assert.assertEquals( + caseBoard1.getCell(i, j).getType(), caseBoard2.getCell(i, j).getType()); + } + } + } + } + + /** + * Given a statement A -> B where ^ is true, tests this case rule by ensuring that two branches + * are created: one where A is false and one where B is true. + */ + @Test + public void SimpleStatement1TrueTest() throws InvalidFileFormatException { + trueConditionalTest("TrueConditional", 1, 0, 0, 0, 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where the -> is true, tests this case rule by ensuring that + * two branches are created: one where ~ is false and one where ^ is true. + */ + @Test + public void ComplexStatement1TrueTest() throws InvalidFileFormatException { + trueConditionalTest("ComplexStatement1_True", 6, 0, 0, 0, 9, 0); + } + + private void falseConditionalTest( + String fileName, int conditionalX, int conditionalY, int aX, int aY, int bX, int bY) + throws InvalidFileFormatException { + TestUtilities.importTestBoard( + "puzzles/shorttruthtable/rules/ConditionalCaseRule/" + fileName, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell cell = board.getCell(conditionalX, conditionalY); + ArrayList cases = RULE.getCases(board, cell); + + // Make sure that the rule checks out + Assert.assertNull(RULE.checkRule(transition)); + + // There should only be 1 branch + Assert.assertEquals(1, cases.size()); + + ShortTruthTableBoard caseBoard = (ShortTruthTableBoard) cases.get(0); + ShortTruthTableCellType caseBoardAType = caseBoard.getCell(aX, aY).getType(); + ShortTruthTableCellType caseBoardBType = caseBoard.getCell(bX, bY).getType(); + + // A should be true and B should be false + Assert.assertEquals(caseBoardAType, ShortTruthTableCellType.TRUE); + Assert.assertEquals(caseBoardBType, ShortTruthTableCellType.FALSE); + + // Verify the board dimensions are unchanged + Assert.assertEquals(caseBoard.getHeight(), caseBoard.getHeight(), board.getHeight()); + } + + /** + * Given a statement A -> B where -> is false, tests this case rule by ensuring that one branch + * is created where A is true and B is false. + */ + @Test + public void SimpleStatement1FalseTest() throws InvalidFileFormatException { + falseConditionalTest("FalseConditional", 1, 0, 0, 0, 2, 0); + } + + /** + * Given a statement ~(A|B) -> (C^D) where -> is true, tests this case rule by ensuring that one + * branch is created where ~ is true and ^ is false. + */ + @Test + public void ComplexStatement1FalseTest() throws InvalidFileFormatException { + falseConditionalTest("ComplexStatement1_False", 6, 0, 0, 0, 9, 0); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java new file mode 100644 index 000000000..cfbc98b67 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/ConditionalContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleConditional; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class ConditionalContradictionRuleTest { + + private static final ContradictionRuleConditional RULE = new ContradictionRuleConditional(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A -> B where -> is true + * + *

Asserts that this is a valid application of the rule if and only if both A is true and B + * is false + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/ConditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueConditionalTestHelper(path + first + "T" + second); + } + } + } + + private void trueConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE + && b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A -> B where -> is false + * + *

Asserts that this is a valid application of the rule if and only if A is false or B is + * true + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseConditionalTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/ConditionalContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseConditionalTestHelper(path + first + "F" + second); + } + } + } + + private void falseConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE + || b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A -> B where -> is unknown + * + *

Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownConditionalTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Conditional Introduction + String path = "puzzles/shorttruthtable/rules/ConditionalIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownConditionalTestHelper(path + first + "U" + second); + } + } + } + + private void unknownConditionalTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java new file mode 100644 index 000000000..b95612235 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/NotContradictionRuleTest.java @@ -0,0 +1,67 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleNot; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class NotContradictionRuleTest { + + private static final ContradictionRuleNot RULE = new ContradictionRuleNot(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: ¬A + * + *

Asserts that this is a valid application of the rule if and only if A and B are both true + * or are both false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void notContradictionTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/NotContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + notContradictionTestHelper(path + first + second); + } + } + } + + private void notContradictionTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell not = board.getCell(0, 0); + ShortTruthTableCell a = board.getCell(1, 0); + + if ((not.getType() == ShortTruthTableCellType.TRUE + && a.getType() == ShortTruthTableCellType.TRUE) + || (not.getType() == ShortTruthTableCellType.FALSE + && a.getType() == ShortTruthTableCellType.FALSE)) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } +} diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java index 0bfa6fc6e..4c0fbe8c0 100644 --- a/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java +++ b/src/test/java/puzzles/shorttruthtable/rules/OrCaseRuleTest.java @@ -58,7 +58,7 @@ private void trueOrTest(String fileName, int andX, int andY, int aX, int aY, int Assert.assertNotEquals(board1B, board2B); // First assert the two cells are not equal, then verify that they are either - // unknown or false. + // unknown or true. Assert.assertNotEquals(board1A, board1B); Assert.assertTrue( board1A.equals(ShortTruthTableCellType.UNKNOWN) @@ -130,7 +130,7 @@ private void falseOrTest(String fileName, int andX, int andY, int aX, int aY, in ShortTruthTableCellType caseBoardAType = caseBoard.getCell(aX, aY).getType(); ShortTruthTableCellType caseBoardBType = caseBoard.getCell(bX, bY).getType(); - // Both cells should be true + // Both cells should be false Assert.assertEquals(caseBoardAType, ShortTruthTableCellType.FALSE); Assert.assertEquals(caseBoardBType, ShortTruthTableCellType.FALSE); Assert.assertEquals(caseBoardAType, caseBoardBType); diff --git a/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java new file mode 100644 index 000000000..d03328640 --- /dev/null +++ b/src/test/java/puzzles/shorttruthtable/rules/OrContradictionRuleTest.java @@ -0,0 +1,132 @@ +package puzzles.shorttruthtable.rules; + +import edu.rpi.legup.model.tree.TreeNode; +import edu.rpi.legup.model.tree.TreeTransition; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTable; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableBoard; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCell; +import edu.rpi.legup.puzzle.shorttruthtable.ShortTruthTableCellType; +import edu.rpi.legup.puzzle.shorttruthtable.rules.contradiction.ContradictionRuleOr; +import edu.rpi.legup.save.InvalidFileFormatException; +import legup.MockGameBoardFacade; +import legup.TestUtilities; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; + +public class OrContradictionRuleTest { + + private static final ContradictionRuleOr RULE = new ContradictionRuleOr(); + private static ShortTruthTable stt; + + @BeforeClass + public static void setUp() { + MockGameBoardFacade.getInstance(); + stt = new ShortTruthTable(); + } + + /** + * Given a statement: A V B where V is true + * + *

Asserts that this is a valid application of the rule if and only if both A and B are set + * to false. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void trueOrTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/OrContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + trueOrTestHelper(path + first + "T" + second); + } + } + } + + private void trueOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.FALSE + && b.getType() == ShortTruthTableCellType.FALSE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A V B where V is false + * + *

Asserts that this is a valid application of the rule if and only if A or B is set to true + * or both A and B are set to true. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void falseOrTest() throws InvalidFileFormatException { + String path = "puzzles/shorttruthtable/rules/OrContradictionRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + falseOrTestHelper(path + first + "F" + second); + } + } + } + + private void falseOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + ShortTruthTableBoard board = (ShortTruthTableBoard) transition.getBoard(); + ShortTruthTableCell a = board.getCell(0, 0); + ShortTruthTableCell b = board.getCell(2, 0); + + if (a.getType() == ShortTruthTableCellType.TRUE + || b.getType() == ShortTruthTableCellType.TRUE) { + Assert.assertNull(RULE.checkContradiction(transition.getBoard())); + } else { + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } + } + + /** + * Given a statement: A V B where V is unknown + * + *

Asserts that this is not a valid application of this rule. + * + * @param filePath The file path for test board setup. + * @throws InvalidFileFormatException + */ + @Test + public void unknownOrTest() throws InvalidFileFormatException { + // Getting the files that have or set to unknown from Or Introduction + String path = "puzzles/shorttruthtable/rules/OrIntroductionDirectRule/"; + String[] letters = {"T", "F", "U"}; + for (String first : letters) { + for (String second : letters) { + unknownOrTestHelper(path + first + "U" + second); + } + } + } + + private void unknownOrTestHelper(String filePath) throws InvalidFileFormatException { + TestUtilities.importTestBoard(filePath, stt); + TreeNode rootNode = stt.getTree().getRootNode(); + TreeTransition transition = rootNode.getChildren().get(0); + transition.setRule(RULE); + + Assert.assertNotNull(RULE.checkContradiction(transition.getBoard())); + } +} diff --git a/src/test/resources/puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree b/src/test/resources/puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree index c5ad17cba..2e2712a50 100644 --- a/src/test/resources/puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree +++ b/src/test/resources/puzzles/lightup/rules/FinishWithEmptyDirectRule/FinishWithEmptyWithThree @@ -3,9 +3,9 @@ - + diff --git a/src/test/resources/puzzles/nurikabe/rules/FinishRoomCaseRule/FinishRoomCaseRuleBase b/src/test/resources/puzzles/nurikabe/rules/FinishRoomCaseRule/FinishRoomCaseRuleBase new file mode 100644 index 000000000..c40870b96 --- /dev/null +++ b/src/test/resources/puzzles/nurikabe/rules/FinishRoomCaseRule/FinishRoomCaseRuleBase @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF new file mode 100644 index 000000000..5285dbb86 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT new file mode 100644 index 000000000..18d6030d9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU new file mode 100644 index 000000000..39b9e9811 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF new file mode 100644 index 000000000..9df198c5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT new file mode 100644 index 000000000..0c2feabe7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU new file mode 100644 index 000000000..d024cb841 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF new file mode 100644 index 000000000..8234ebd2a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT new file mode 100644 index 000000000..4a6b0f1d7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU new file mode 100644 index 000000000..b2bb6e1a5 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF new file mode 100644 index 000000000..9e53ac8e3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT new file mode 100644 index 000000000..837730943 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU new file mode 100644 index 000000000..893f7d3ec --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF new file mode 100644 index 000000000..6d4f44071 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT new file mode 100644 index 000000000..7fcda3fba --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU new file mode 100644 index 000000000..5285dbb86 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF new file mode 100644 index 000000000..d11a314b8 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT new file mode 100644 index 000000000..1772e1986 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU new file mode 100644 index 000000000..9df198c5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AndContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF new file mode 100644 index 000000000..47ede6499 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT new file mode 100644 index 000000000..56192a97b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU new file mode 100644 index 000000000..9e25868fc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/FU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF new file mode 100644 index 000000000..326988fbb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT new file mode 100644 index 000000000..0b8b9b690 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU new file mode 100644 index 000000000..4ee98e3d4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/TU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF new file mode 100644 index 000000000..03432df5f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT new file mode 100644 index 000000000..a69e019a2 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU new file mode 100644 index 000000000..7d1f0bae6 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/AtomicContradictionRule/UU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False new file mode 100644 index 000000000..8f31d9771 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_False @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True new file mode 100644 index 000000000..f0bb0d508 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/ComplexStatement1_True @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional new file mode 100644 index 000000000..5ea1c8a63 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/FalseBiconditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional new file mode 100644 index 000000000..cbf64468f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/TrueBiconditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional new file mode 100644 index 000000000..82cdeb3ea --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalCaseRule/UnknownConditional @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF new file mode 100644 index 000000000..b1c975982 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT new file mode 100644 index 000000000..9aaa26431 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU new file mode 100644 index 000000000..150134e46 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF new file mode 100644 index 000000000..e1cecaeb7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT new file mode 100644 index 000000000..370cefc0a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU new file mode 100644 index 000000000..4ac904290 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF new file mode 100644 index 000000000..48e1fa36b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT new file mode 100644 index 000000000..a260489cc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU new file mode 100644 index 000000000..08a999c1a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF new file mode 100644 index 000000000..c6764d0fb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT new file mode 100644 index 000000000..7ce20257b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU new file mode 100644 index 000000000..b440c157a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF new file mode 100644 index 000000000..865d9b59b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT new file mode 100644 index 000000000..31f372a95 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU new file mode 100644 index 000000000..b1c975982 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF new file mode 100644 index 000000000..e1e7eeafc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT new file mode 100644 index 000000000..15ed9b08f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU new file mode 100644 index 000000000..e1cecaeb7 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/BiconditionalContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False new file mode 100644 index 000000000..f8be5f275 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_False @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True new file mode 100644 index 000000000..d919b7214 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/ComplexStatement1_True @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional new file mode 100644 index 000000000..2da458f51 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/FalseConditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional new file mode 100644 index 000000000..829861f75 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/TrueConditional @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional new file mode 100644 index 000000000..deb93776d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalCaseRule/UnknownConditional @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF new file mode 100644 index 000000000..479b8172d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT new file mode 100644 index 000000000..4c328f840 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU new file mode 100644 index 000000000..2a5220f46 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF new file mode 100644 index 000000000..d28a4b9f9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT new file mode 100644 index 000000000..aa0c242b3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU new file mode 100644 index 000000000..b9867188f --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF new file mode 100644 index 000000000..ad3329472 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT new file mode 100644 index 000000000..92eaf7cb3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU new file mode 100644 index 000000000..0ea50831a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF new file mode 100644 index 000000000..d0e4ec7bb --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT new file mode 100644 index 000000000..e2f1a7102 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU new file mode 100644 index 000000000..0a38381b1 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF new file mode 100644 index 000000000..78ff4e0f0 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT new file mode 100644 index 000000000..9ac9c39fa --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU new file mode 100644 index 000000000..479b8172d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF new file mode 100644 index 000000000..cc05da528 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT new file mode 100644 index 000000000..0559dcf83 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU new file mode 100644 index 000000000..d28a4b9f9 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/ConditionalContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF new file mode 100644 index 000000000..56b5cd97e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT new file mode 100644 index 000000000..5091d620c --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU new file mode 100644 index 000000000..ae65d166d --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/FU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF new file mode 100644 index 000000000..cf510f0c3 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT new file mode 100644 index 000000000..7bcb69b15 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU new file mode 100644 index 000000000..a33ef3016 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/TU @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF new file mode 100644 index 000000000..96bc1fb52 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UF @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT new file mode 100644 index 000000000..b87293cdc --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UT @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU new file mode 100644 index 000000000..78bd1d67e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/NotContradictionRule/UU @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF new file mode 100644 index 000000000..32c62f59e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT new file mode 100644 index 000000000..96e3122bf --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU new file mode 100644 index 000000000..b9bb63a6b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF new file mode 100644 index 000000000..062c5d3e4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT new file mode 100644 index 000000000..4fbb5922a --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU new file mode 100644 index 000000000..1767546df --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/FTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF new file mode 100644 index 000000000..3e50d3b54 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT new file mode 100644 index 000000000..69cbef4db --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU new file mode 100644 index 000000000..018064192 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TFU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF new file mode 100644 index 000000000..8247a1cfa --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTF @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT new file mode 100644 index 000000000..4446c1e34 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTT @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU new file mode 100644 index 000000000..c662ec79b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/TTU @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF new file mode 100644 index 000000000..dae9e4311 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT new file mode 100644 index 000000000..1c68eb53b --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU new file mode 100644 index 000000000..32c62f59e --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UFU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF new file mode 100644 index 000000000..67169da0c --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTF @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT new file mode 100644 index 000000000..c761569c5 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTT @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU new file mode 100644 index 000000000..062c5d3e4 --- /dev/null +++ b/src/test/resources/puzzles/shorttruthtable/rules/OrContradictionRule/UTU @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +