-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
355 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/test/java/puzzles/treetent/rules/TentOrGrassCaseRuleTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package puzzles.treetent.rules; | ||
|
||
import edu.rpi.legup.model.gameboard.Board; | ||
import edu.rpi.legup.model.tree.Tree; | ||
import edu.rpi.legup.model.tree.TreeNode; | ||
import edu.rpi.legup.model.tree.TreeTransition; | ||
import edu.rpi.legup.puzzle.treetent.TreeTent; | ||
import edu.rpi.legup.puzzle.treetent.TreeTentBoard; | ||
import edu.rpi.legup.puzzle.treetent.TreeTentCell; | ||
import edu.rpi.legup.puzzle.treetent.TreeTentType; | ||
import edu.rpi.legup.puzzle.treetent.rules.FillinRowCaseRule; | ||
import edu.rpi.legup.puzzle.treetent.rules.TentOrGrassCaseRule; | ||
import edu.rpi.legup.save.InvalidFileFormatException; | ||
import legup.MockGameBoardFacade; | ||
import legup.TestUtilities; | ||
import org.junit.Assert; | ||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
import java.awt.*; | ||
import java.util.ArrayList; | ||
|
||
public class TentOrGrassCaseRuleTest { | ||
private static final TentOrGrassCaseRule RULE = new TentOrGrassCaseRule(); | ||
private static TreeTent treetent; | ||
|
||
@BeforeClass | ||
public static void setUp(){ | ||
MockGameBoardFacade.getInstance(); | ||
treetent = new TreeTent(); | ||
} | ||
|
||
/** | ||
* @throws InvalidFileFormatException | ||
* A temporary test | ||
*/ | ||
@Test | ||
public void TentOrGrassCaseRule_Test() throws InvalidFileFormatException { | ||
TestUtilities.importTestBoard("puzzles/treetent/rules/TentOrGrassCaseRule/TentOrGrassTest", treetent); | ||
TreeNode rootNode = treetent.getTree().getRootNode(); | ||
TreeTransition transition = rootNode.getChildren().get(0); | ||
transition.setRule(RULE); | ||
|
||
TreeTentBoard board = (TreeTentBoard) transition.getBoard(); | ||
TreeTentCell testing_cell = board.getCell(1, 0); | ||
ArrayList<Board> cases = RULE.getCases(board, testing_cell); | ||
// assert correct number of cases created | ||
Assert.assertEquals(2, cases.size()); | ||
//Store the 0,1 cells from each case | ||
//Assert that the Array of their states match to a an array of the expected. | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/test/resources/puzzles/treetent/rules/TentOrGrassCaseRule/TentOrGrassTest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="2" width="2"> | ||
<cells> | ||
<cell value="1" x="0" y="0"/> | ||
<cell value="2" x="0" y="1"/> | ||
<cell value="2" x="1" y="1"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="1"/> | ||
<clue index="B" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="0"/> | ||
<clue index="2" value="1"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/puzzles/treetent/rules/TooFewTentsContradictionRule/TooFewTents2x2Column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="2" width="2"> | ||
<cells> | ||
<cell value="1" x="1" y="0"/> | ||
<cell value="2" x="1" y="1"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="0"/> | ||
<clue index="B" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="0"/> | ||
<clue index="2" value="1"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
19 changes: 19 additions & 0 deletions
19
src/test/resources/puzzles/treetent/rules/TooFewTentsContradictionRule/TooFewTents2x2Row
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="2" width="2"> | ||
<cells> | ||
<cell value="1" x="0" y="0"/> | ||
<cell value="2" x="1" y="0"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="1"/> | ||
<clue index="B" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="0"/> | ||
<clue index="2" value="0"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
22 changes: 22 additions & 0 deletions
22
src/test/resources/puzzles/treetent/rules/TooFewTentsContradictionRule/TooFewTents3x3Column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="3" width="3"> | ||
<cells> | ||
<cell value="1" x="1" y="0"/> | ||
<cell value="2" x="1" y="1"/> | ||
<cell value="2" x="1" y="2"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="0"/> | ||
<clue index="B" value="0"/> | ||
<clue index="C" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="0"/> | ||
<clue index="2" value="1"/> | ||
<clue index="3" value="0"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
27 changes: 27 additions & 0 deletions
27
.../resources/puzzles/treetent/rules/TooFewTentsContradictionRule/TooFewTents3x3DoubleColumn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="3" width="3"> | ||
<cells> | ||
<cell value="2" x="0" y="0"/> | ||
<cell value="2" x="0" y="1"/> | ||
<cell value="2" x="0" y="2"/> | ||
<cell value="1" x="1" y="0"/> | ||
<cell value="1" x="1" y="2"/> | ||
<cell value="2" x="2" y="0"/> | ||
<cell value="2" x="2" y="1"/> | ||
<cell value="2" x="2" y="2"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="0"/> | ||
<clue index="B" value="0"/> | ||
<clue index="C" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="1"/> | ||
<clue index="2" value="0"/> | ||
<clue index="3" value="1"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |
19 changes: 19 additions & 0 deletions
19
.../resources/puzzles/treetent/rules/TooFewTentsContradictionRule/TooFewTentsNoContradiction
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Legup> | ||
<puzzle name="TreeTent"> | ||
<board height="2" width="2"> | ||
<cells> | ||
<cell value="3" x="0" y="0"/> | ||
<cell value="1" x="0" y="1"/> | ||
</cells> | ||
<axis side="east"> | ||
<clue index="A" value="1"/> | ||
<clue index="B" value="0"/> | ||
</axis> | ||
<axis side="south"> | ||
<clue index="1" value="1"/> | ||
<clue index="2" value="0"/> | ||
</axis> | ||
</board> | ||
</puzzle> | ||
<solved isSolved="false" lastSaved="--"/> | ||
</Legup> |