-
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.
Merge branch 'thermometer' into thermometer
- Loading branch information
Showing
6 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
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 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<Legup version="5.1.0"> | ||
<puzzle name="Thermometer"> | ||
<board height="4" width="4"> | ||
<vials> | ||
<vial headx="0" heady="0" tailx="2" taily="0"/> | ||
<vial headx="3" heady="0" tailx="3" taily="3"/> | ||
<vial headx="0" heady="1" tailx="1" taily="1"/> | ||
<vial headx="2" heady="1" tailx="2" taily="3"/> | ||
<vial headx="0" heady="3" tailx="0" taily="2"/> | ||
<vial headx="1" heady="2" tailx="1" taily="3"/> | ||
</vials> | ||
<rowNumbers> | ||
<row value="3"/> | ||
<row value="2"/> | ||
<row value="2"/> | ||
<row value="2"/> | ||
</rowNumbers> | ||
<colNumbers> | ||
<col value="2"/> | ||
<col value="4"/> | ||
<col value="2"/> | ||
<col value="1"/> | ||
</colNumbers> | ||
</board> | ||
</puzzle> | ||
</Legup> |
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
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
46 changes: 46 additions & 0 deletions
46
src/main/java/edu/rpi/legup/puzzle/thermometer/rules/FinishColumnWithEmptyDirectRule.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,46 @@ | ||
package edu.rpi.legup.puzzle.thermometer.rules; | ||
|
||
import edu.rpi.legup.model.gameboard.Board; | ||
import edu.rpi.legup.model.gameboard.PuzzleElement; | ||
import edu.rpi.legup.model.rules.DirectRule; | ||
import edu.rpi.legup.model.tree.TreeNode; | ||
import edu.rpi.legup.model.tree.TreeTransition; | ||
import edu.rpi.legup.puzzle.thermometer.ThermometerBoard; | ||
|
||
public class FinishColumnWithEmptyDirectRule extends DirectRule { | ||
|
||
public FinishColumnWithEmptyDirectRule() { | ||
super("FCE", | ||
"Finish Column with Empty", | ||
"When a column is filled with mercury equal to the corresponding edge number, the rest are blocked.", | ||
"edu/rpi/legup/images/nurikabe/rules/FinishColumnWithEmpty.png"); | ||
} | ||
|
||
/** | ||
* Checks whether the child node logically follows from the parent node at the specific | ||
* puzzleElement index using this rule | ||
* | ||
* @param transition transition to check | ||
* @param puzzleElement equivalent puzzleElement | ||
* @return null if the child node logically follow from the parent node at the specified | ||
* puzzleElement, otherwise error message | ||
*/ | ||
@Override | ||
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { | ||
ThermometerBoard board = (ThermometerBoard) transition.getBoard(); | ||
ThermometerBoard origBoard = (ThermometerBoard) transition.getParents().get(0).getBoard(); | ||
|
||
// Grab the puzzleElement (Array of X'd cells? Or compare board to origBoard?) | ||
// Get the column that is being changed | ||
// Get the number of filled vials in the row | ||
// If the number filled != number given, throw error | ||
|
||
// All is well, valid | ||
return null; | ||
} | ||
|
||
@Override | ||
public Board getDefaultBoard(TreeNode node) { | ||
return null; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/edu/rpi/legup/puzzle/thermometer/rules/FinishRowWithEmptyDirectRule.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,46 @@ | ||
package edu.rpi.legup.puzzle.thermometer.rules; | ||
|
||
import edu.rpi.legup.model.gameboard.Board; | ||
import edu.rpi.legup.model.gameboard.PuzzleElement; | ||
import edu.rpi.legup.model.rules.DirectRule; | ||
import edu.rpi.legup.model.tree.TreeNode; | ||
import edu.rpi.legup.model.tree.TreeTransition; | ||
import edu.rpi.legup.puzzle.thermometer.ThermometerBoard; | ||
|
||
public class FinishRowWithEmptyDirectRule extends DirectRule { | ||
|
||
public FinishRowWithEmptyDirectRule() { | ||
super("FRE", | ||
"Finish Row with Empty", | ||
"When a row is filled with mercury equal to the corresponding edge number, the rest are blocked.", | ||
"edu/rpi/legup/images/nurikabe/rules/FinishRowWithEmpty.png"); | ||
} | ||
|
||
/** | ||
* Checks whether the child node logically follows from the parent node at the specific | ||
* puzzleElement index using this rule | ||
* | ||
* @param transition transition to check | ||
* @param puzzleElement equivalent puzzleElement | ||
* @return null if the child node logically follow from the parent node at the specified | ||
* puzzleElement, otherwise error message | ||
*/ | ||
@Override | ||
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { | ||
ThermometerBoard board = (ThermometerBoard) transition.getBoard(); | ||
ThermometerBoard origBoard = (ThermometerBoard) transition.getParents().get(0).getBoard(); | ||
|
||
// Grab the puzzleElement (Array of X'd cells? Or compare board to origBoard?) | ||
// Get the row that is being changed | ||
// Get the number of filled vials in the row | ||
// If the number filled != number given, throw error | ||
|
||
// All is well, valid | ||
return null; | ||
} | ||
|
||
@Override | ||
public Board getDefaultBoard(TreeNode node) { | ||
return null; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/edu/rpi/legup/puzzle/thermometer/rules/RestIsEmptyDirectRule.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,48 @@ | ||
package edu.rpi.legup.puzzle.thermometer.rules; | ||
|
||
import edu.rpi.legup.model.gameboard.Board; | ||
import edu.rpi.legup.model.gameboard.PuzzleElement; | ||
import edu.rpi.legup.model.rules.DirectRule; | ||
import edu.rpi.legup.model.tree.TreeNode; | ||
import edu.rpi.legup.model.tree.TreeTransition; | ||
import edu.rpi.legup.puzzle.thermometer.ThermometerBoard; | ||
|
||
public class RestIsEmptyDirectRule extends DirectRule { | ||
|
||
public RestIsEmptyDirectRule() { | ||
super("RIE", | ||
"Rest Is Empty", | ||
"If mercury is blocked at a non-tail section, the rest of the thermometer is also blocked.", | ||
"edu/rpi/legup/images/nurikabe/rules/RestIsEmpty.png"); | ||
} | ||
|
||
/** | ||
* Checks whether the child node logically follows from the parent node at the specific | ||
* puzzleElement index using this rule | ||
* | ||
* @param transition transition to check | ||
* @param puzzleElement equivalent puzzleElement | ||
* @return null if the child node logically follow from the parent node at the specified | ||
* puzzleElement, otherwise error message | ||
*/ | ||
@Override | ||
public String checkRuleRawAt(TreeTransition transition, PuzzleElement puzzleElement) { | ||
ThermometerBoard board = (ThermometerBoard) transition.getBoard(); | ||
ThermometerBoard origBoard = (ThermometerBoard) transition.getParents().get(0).getBoard(); | ||
|
||
// Grab the puzzleElement (Array of X'd cells? Or compare board to origBoard?) | ||
// Ensure we only X'd a single vial, else return error | ||
// Find the closest cell to the head of the vial | ||
// If vertical, check to ensure # of filled cells in that row = outside #, else return error | ||
// If horizontal, check to ensure # of filled cells in that column = outside #, else return error | ||
// Make sure every vial from the closest to head cell to the tail is X'd, else return error | ||
|
||
// All is well, valid | ||
return null; | ||
} | ||
|
||
@Override | ||
public Board getDefaultBoard(TreeNode node) { | ||
return null; | ||
} | ||
} |