Skip to content

Commit

Permalink
Merge branch 'master' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
charlestian23 authored Dec 14, 2023
2 parents 80328d5 + 05b310b commit e6f3279
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = 'LEGUP'

Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public void EmptyCornersTest() throws InvalidFileFormatException {
TestUtilities.importTestBoard("puzzles/lightup/rules/EmptyCornersDirectRule/EmptyCorners", lightUp);
TreeNode rootNode = lightUp.getTree().getRootNode();
TreeTransition transition = rootNode.getChildren().get(0);
transition.setRule(RULE);
transition.setRule(RULE);

//get board state
LightUpBoard board = (LightUpBoard) transition.getBoard();

Expand All @@ -42,16 +42,32 @@ public void EmptyCornersTest() throws InvalidFileFormatException {
cell2.setData(LightUpCellType.EMPTY.value);
board.addModifiedData(cell2);

LightUpCell cell3 = board.getCell(4,3);
cell3.setData(LightUpCellType.EMPTY.value);
board.addModifiedData(cell3);

//confirm there is a logical following of the EmptyCorners rule
Assert.assertNull(RULE.checkRule(transition));

//this should not be accepted, the cell should remain unknown
LightUpCell cell4 = board.getCell(4,5);
cell4.setData(LightUpCellType.EMPTY.value);
board.addModifiedData(cell4);

//this should not be accepted, the cell should be empty but not because of this rule
LightUpCell cell5 = board.getCell(4,1);
cell5.setData(LightUpCellType.EMPTY.value);
board.addModifiedData(cell5);

Assert.assertNotNull(RULE.checkRule(transition));

//confirm the two expected cells are emptied USING THE RULE
// and none of the rest are (others can be empty just not by the same rule)
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 == 2 && j == 0) || (i == 2 && j == 2)){
if ((i == 2 && j == 0) || (i == 2 && j == 2) || (i==3 && j==4)){
Assert.assertNull(RULE.checkRuleAt(transition, c));
}
else {
Expand All @@ -60,4 +76,4 @@ public void EmptyCornersTest() throws InvalidFileFormatException {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Legup>
<puzzle name="LightUp">
<board width="3" height="3">
<board width="6" height="6">
<cells>
<cell value="3" x="1" y="1"/>
<cell value="-4" x="1" y="0"/>
<cell value="2" x="3" y="4"/>
<cell value="2" x="5" y="2"/>
<cell value="-4" x="2" y="4"/>
<cell value="-4" x="5" y="1"/>
</cells>
</board>
</puzzle>
Expand Down

0 comments on commit e6f3279

Please sign in to comment.