Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -161,13 +175,13 @@ private void generateCases(
LightUpCell modCell = (LightUpCell) mod.copy();
Point modLoc = modCell.getLocation();

modCell.setData(-4);
modCell.setData(LightUpCellType.BULB.value);

newCase.setCell(modLoc.x, modLoc.y, modCell);
newCase.addModifiedData(modCell);
}

newCell.setData(-4);
newCell.setData(LightUpCellType.BULB.value);

newCase.setCell(loc.x, loc.y, newCell);
newCase.addModifiedData(newCell);
Expand Down