fix: serialize
This commit is contained in:
@@ -27,10 +27,6 @@ public class RenderableMultidoku {
|
||||
this.doku = doku;
|
||||
}
|
||||
|
||||
public boolean isResolved() {
|
||||
return this.doku.isSolved();
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
@@ -51,21 +47,7 @@ public class RenderableMultidoku {
|
||||
return cells.get(index);
|
||||
}
|
||||
|
||||
public boolean setCellValue(Cell cell, int value) {
|
||||
for (Sudoku s : doku.getSubGrids()) {
|
||||
int cellIndex = s.getCells().indexOf(cell);
|
||||
// la cellule existe
|
||||
if (cellIndex != -1) {
|
||||
int cellX = cellIndex % s.getSize();
|
||||
int cellY = cellIndex / s.getSize();
|
||||
if (!s.canBePlaced(cellX, cellY, value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
cell.setSymbolIndex(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
private static record PositionConstraint(Sudoku sudoku1, Sudoku sudoku2, Coordinate offset) {
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ public class SudokuRenderer {
|
||||
}
|
||||
} else {
|
||||
if (ImGui.button(Integer.toString(i + 1), cellSize)) {
|
||||
this.doku.setCellValue(currentCell, i);
|
||||
if (this.doku.isResolved())
|
||||
currentCell.trySetValue(i);
|
||||
if (this.doku.getDoku().isSolved())
|
||||
this.onResolve.emit();
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user