diff --git a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java index f56f2ec8f..bb6cca121 100644 --- a/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/nurikabe/rules/FinishRoomCaseRule.java @@ -17,6 +17,7 @@ import java.util.Set; public class FinishRoomCaseRule extends CaseRule { + private int legitCases = 0; //placeholder for amount of cases originally generated in case user tries to delete cases public FinishRoomCaseRule() { super( "NURI-CASE-0002", @@ -46,6 +47,9 @@ public String checkRuleRaw(TreeTransition transition) { return super.getInvalidUseOfRuleMessage() + ": This case rule must have 2 or more children."; } + if (childTransitions.size() != legitCases) { + return super.getInvalidUseOfRuleMessage() + ": Cases can not be removed from the branch."; + } //stops user from deleting 1 or mose generated cases and still having path show as green Set locations = new HashSet<>(); for (TreeTransition t1 : childTransitions) { locations.add( @@ -220,7 +224,7 @@ public ArrayList getCases( regions = NurikabeUtilities.getNurikabeRegions(nuriBoard); // updates regions } } - } + legitCases = cases.size(); return cases; }