From 2be05d7ba0f97ad09e0e615a3b9cd3382ea5802c Mon Sep 17 00:00:00 2001 From: busabj Date: Tue, 10 Feb 2026 10:11:27 -0500 Subject: [PATCH 1/2] Fixed Satisfy Number Case Rule Bug --- .../lightup/rules/SatisfyNumberCaseRule.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java index bc4f8b994..6d912597a 100644 --- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java @@ -145,6 +145,20 @@ private void generateCases( LightUpBoard curBoard, int index) { if (num <= curBoard.getModifiedData().size()) { + // Mark remaining open spots (that didn't get bulbs) as empty + for (LightUpCell openSpot : openSpots) { + Point loc = openSpot.getLocation(); + LightUpCell cell = curBoard.getCell(loc.x, loc.y); + + // If this cell wasn't already marked with a bulb, mark it as empty + if (!curBoard.getModifiedData().contains(cell)) { + LightUpCell emptyCell = cell.copy(); + emptyCell.setData(LightUpCellType.EMPTY.value); + curBoard.setCell(loc.x, loc.y, emptyCell); + curBoard.addModifiedData(emptyCell); + } + } + cases.add(curBoard); return; } @@ -161,13 +175,13 @@ private void generateCases( LightUpCell modCell = (LightUpCell) mod.copy(); Point modLoc = modCell.getLocation(); - modCell.setData(-4); + modCell.setData(LightUpCellType.BULB.value); // FIXED: Changed from -4 newCase.setCell(modLoc.x, modLoc.y, modCell); newCase.addModifiedData(modCell); } - newCell.setData(-4); + newCell.setData(LightUpCellType.BULB.value); // FIXED: Changed from -4 newCase.setCell(loc.x, loc.y, newCell); newCase.addModifiedData(newCell); From cda213fafa35531c438378010005f5466c41f64a Mon Sep 17 00:00:00 2001 From: busabj Date: Tue, 10 Feb 2026 17:00:53 -0500 Subject: [PATCH 2/2] rid unnecessary comment --- .../rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java index 6d912597a..83fdd75c6 100644 --- a/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java +++ b/src/main/java/edu/rpi/legup/puzzle/lightup/rules/SatisfyNumberCaseRule.java @@ -175,13 +175,13 @@ private void generateCases( LightUpCell modCell = (LightUpCell) mod.copy(); Point modLoc = modCell.getLocation(); - modCell.setData(LightUpCellType.BULB.value); // FIXED: Changed from -4 + modCell.setData(LightUpCellType.BULB.value); newCase.setCell(modLoc.x, modLoc.y, modCell); newCase.addModifiedData(modCell); } - newCell.setData(LightUpCellType.BULB.value); // FIXED: Changed from -4 + newCell.setData(LightUpCellType.BULB.value); newCase.setCell(loc.x, loc.y, newCell); newCase.addModifiedData(newCell);