Skip to content

Commit

Permalink
False justification bug fix
Browse files Browse the repository at this point in the history
Fixes green arrow when using case rule after altering 1 random tile. Also sets minimum cases number to 2.
  • Loading branch information
cadogs committed Mar 29, 2024
1 parent f650c4f commit cd4fabe
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
import java.util.Set;

public class FinishRoomCaseRule extends CaseRule {

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"); //new image
"edu/rpi/legup/images/nurikabe/cases/FinishRoom.png");
this.MAX_CASES = 5;
this.MIN_CASES = 2;
}

/**
Expand All @@ -41,6 +41,9 @@ public String checkRuleRaw(TreeTransition transition) {
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.";
}
Set<Point> locations = new HashSet<>();
for (TreeTransition t1 : childTransitions) {
locations.add(((NurikabeCell) t1.getBoard().getModifiedData().iterator().next()).getLocation()); //loop see if matches
Expand Down

0 comments on commit cd4fabe

Please sign in to comment.