Skip to content

Commit

Permalink
Merge pull request #61 from Bram-Hub/uid_add_nurikabe_id
Browse files Browse the repository at this point in the history
UID Rule IDs and Nurikabe IDs
  • Loading branch information
charlestian23 authored Dec 21, 2021
2 parents c77bacd + 247fc7d commit c751610
Show file tree
Hide file tree
Showing 24 changed files with 67 additions and 26 deletions.
Binary file modified legup-update/build/libs/legup-update-2.0.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions src/main/java/edu/rpi/legup/model/rules/BasicRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ public abstract class BasicRule extends Rule {
/**
* BasicRule Constructor creates a new basic rule.
*
* @param ruleID ID of the rule
* @param ruleName name of the rule
* @param description description of the rule
* @param imageName file name of the image
*/
public BasicRule(String ruleName, String description, String imageName) {
super(ruleName, description, imageName);
public BasicRule(String ruleID, String ruleName, String description, String imageName) {
super(ruleID, ruleName, description, imageName);
this.ruleType = BASIC;
}

Expand Down
5 changes: 3 additions & 2 deletions src/main/java/edu/rpi/legup/model/rules/CaseRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ public abstract class CaseRule extends Rule {
/**
* CaseRule Constructor creates a new case rule.
*
* @param ruleID ID of the rule
* @param ruleName name of the rule
* @param description description of the rule
* @param imageName file name of the image
*/
public CaseRule(String ruleName, String description, String imageName) {
super(ruleName, description, imageName);
public CaseRule(String ruleID, String ruleName, String description, String imageName) {
super(ruleID, ruleName, description, imageName);
this.ruleType = CASE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ public abstract class ContradictionRule extends Rule {
/**
* ContradictionRule Constructor creates a new contradiction rule
*
* @param ruleID ID of the rule
* @param ruleName name of the rule
* @param description description of the rule
* @param imageName file name of the image
*/
public ContradictionRule(String ruleName, String description, String imageName) {
super(ruleName, description, imageName);
public ContradictionRule(String ruleID, String ruleName, String description, String imageName) {
super(ruleID, ruleName, description, imageName);
ruleType = CONTRADICTION;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/rpi/legup/model/rules/MergeRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class MergeRule extends Rule {
* MergeRule Constructor merges to board states together
*/
public MergeRule() {
super("Merge Rule",
super("MERGE","Merge Rule",
"Merge any number of nodes into one",
"edu/rpi/legup/images/Legup/MergeRule.png");
this.ruleType = MERGE;
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/edu/rpi/legup/model/rules/Rule.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

@RegisterRule
public abstract class Rule {
protected String ruleID;
protected String ruleName;
protected String description;
protected String imageName;
Expand All @@ -22,14 +23,16 @@ public abstract class Rule {
/**
* Rule Constructor creates a new rule
*
* @param ruleID ID of the rule
* @param ruleName name of the rule
* @param description description of the rule
* @param imageName file name of the image
*/
public Rule(String ruleName, String description, String imageName) {
this.imageName = imageName;
public Rule(String ruleID, String ruleName, String description, String imageName) {
this.ruleID = ruleID;
this.ruleName = ruleName;
this.description = description;
this.imageName = imageName;
loadImage();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
public class BlackBetweenRegionsBasicRule extends BasicRule {

public BlackBetweenRegionsBasicRule() {
super("Black Between Regions",
super("NURIK-BASIC-00001",
"Black Between Regions",
"Any unknowns between two regions must be black.",
"edu/rpi/legup/images/nurikabe/rules/BetweenRegions.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class BlackBottleNeckBasicRule extends BasicRule {

public BlackBottleNeckBasicRule() {
super("Black Bottle Neck",
super("NURIK-BASIC-00002",
"Black Bottle Neck",
"If there is only one path for a black to escape, then those unknowns must be white.",
"edu/rpi/legup/images/nurikabe/rules/OneUnknownBlack.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
public class BlackOrWhiteCaseRule extends CaseRule {

public BlackOrWhiteCaseRule() {
super("Black or White",
super("NURI-CASE-0001",
"Black or White",
"Each blank cell is either black or white.",
"edu/rpi/legup/images/nurikabe/cases/BlackOrWhite.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
public class BlackSquareContradictionRule extends ContradictionRule {

public BlackSquareContradictionRule() {
super("Black Square",
super("NURI-CONT-0001",
"Black Square",
"There cannot be a 2x2 square of black.",
"edu/rpi/legup/images/nurikabe/contradictions/BlackSquare.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
public class CantReachWhiteContradictionRule extends ContradictionRule {

public CantReachWhiteContradictionRule() {
super("Cant Reach white cell",
super("NURI-CONT-0002",
"Cant Reach white cell",
"A white cell must be able to reach a white region",
"edu/rpi/legup/images/nurikabe/contradictions/CantReach.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
public class CornerBlackBasicRule extends BasicRule {

public CornerBlackBasicRule() {
super("Corners Black",
super("NURI-BASC-0003",
"Corners Black",
"If there is only one white square connected to unknowns and one more white is needed then the angles of that white square are black",
"edu/rpi/legup/images/nurikabe/rules/CornerBlack.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class FillinBlackBasicRule extends BasicRule {

public FillinBlackBasicRule() {
super("Fill In Black",
super("NURI-BASC-0004",
"Fill In Black",
"If there an unknown region surrounded by black, it must be black.",
"edu/rpi/legup/images/nurikabe/rules/FillInBlack.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class FillinWhiteBasicRule extends BasicRule {

public FillinWhiteBasicRule() {
super("Fill In White",
super("NURI-BASC-0005",
"Fill In White",
"If there an unknown region surrounded by white, it must be white.",
"edu/rpi/legup/images/nurikabe/rules/FillInWhite.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
public class IsolateBlackContradictionRule extends ContradictionRule {

public IsolateBlackContradictionRule() {
super("Isolated Black",
super("NURI-CONT-0003",
"Isolated Black",
"There must still be a possibility to connect every Black cell",
"edu/rpi/legup/images/nurikabe/contradictions/BlackArea.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
public class MultipleNumbersContradictionRule extends ContradictionRule {

public MultipleNumbersContradictionRule() {
super("Multiple Numbers",
super("NURI-CONT-0004",
"Multiple Numbers",
"All white regions cannot have more than one number.",
"edu/rpi/legup/images/nurikabe/contradictions/MultipleNumbers.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
public class NoNumberContradictionRule extends ContradictionRule {

public NoNumberContradictionRule() {
super("No Number",
super("NURI-CONT-0005",
"No Number",
"All enclosed white regions must have a number.",
"edu/rpi/legup/images/nurikabe/contradictions/NoNumber.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
public class PreventBlackSquareBasicRule extends BasicRule {

public PreventBlackSquareBasicRule() {
super("Prevent Black Square",
super("NURI-BASC-0006",
"Prevent Black Square",
"There cannot be a 2x2 square of black. (3 blacks = fill in last corner white)",
"edu/rpi/legup/images/nurikabe/rules/NoBlackSquare.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class SurroundRegionBasicRule extends BasicRule {

public SurroundRegionBasicRule() {
super("Surround Region",
super("NURI-BASC-0007","Surround Region",
"Surround Region",
"edu/rpi/legup/images/nurikabe/rules/SurroundBlack.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
public class TooFewSpacesContradictionRule extends ContradictionRule {

public TooFewSpacesContradictionRule() {
super("Too Few Spaces",
super("NURI-CONT-0006",
"Too Few Spaces",
"A region cannot contain less spaces than its number.",
"edu/rpi/legup/images/nurikabe/contradictions/TooFewSpaces.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
public class TooManySpacesContradictionRule extends ContradictionRule {

public TooManySpacesContradictionRule() {
super("Too Many Spaces",
super("NURI-CONT-0007",
"Too Many Spaces",
"A region cannot contain more spaces than its number.",
"edu/rpi/legup/images/nurikabe/contradictions/TooManySpaces.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

public class UnreachableBasicRule extends BasicRule {
public UnreachableBasicRule() {
super("Unreachable white region",
super("NURI-BASC-0008",
"Unreachable white region",
"A cell must be black if it cannot be reached by any white region",
"edu/rpi/legup/images/nurikabe/rules/Unreachable.png");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
public class WhiteBottleNeckBasicRule extends BasicRule {

public WhiteBottleNeckBasicRule() {
super("White Bottle Neck",
super("NURI-BASC-0009",
"White Bottle Neck",
"If a region needs more whites and there is only one path for the region to expand, then those unknowns must be white.", "edu/rpi/legup/images/nurikabe/rules/OneUnknownWhite.png");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
NURI-BASC-0001 : BlackBetweenRegionsBasicRule
NURI-BASC-0002 : BlackBottleNeckBasicRule
NURI-BASC-0003 : CornerBlackBasicRule
NURI-BASC-0004 : FillinBlackBasicRule
NURI-BASC-0005 : FillinWhiteBasicRule
NURI-BASC-0006 : PreventBlackSquareBasicRule
NURI-BASC-0007 : SurroundRegionBasicRule
NURI-BASC-0008 : UnreachableBasicRule
NURI-BASC-0009 : WhiteBottleNeckBasicRule

NURI-CONT-0001 : BlackSquareContradictionRule
NURI-CONT-0002 : CantReachWhiteContradictionRule
NURI-CONT-0003 : IsolateBlackContradictionRule
NURI-CONT-0004 : MultipleNumbersContradictionRule
NURI-CONT-0005 : NoNumberContradictionRule
NURI-CONT-0006 : TooFewSpacesContradictionRule
NURI-CONT-0007 : TooManySpacesContradictionRule

NURI-CASE-0001 : BlackOrWhiteCaseRule

0 comments on commit c751610

Please sign in to comment.