fix: serialize

This commit is contained in:
2025-01-30 00:51:22 +01:00
committed by Melvyn
parent f1d963e546
commit c4becf2d55
11 changed files with 212 additions and 415 deletions

View File

@@ -24,9 +24,8 @@ public class StupidSolver {
if (!sudoku.getCell(index).isMutable())
return solve(sudoku, index + 1);
Coordinate coords = sudoku.toCoords(index);
for (int symbol = 0; symbol < sudoku.getSize(); symbol++) {
if (sudoku.tryPlaceCellSymbol(coords.getX(), coords.getY(), symbol)) {
if (sudoku.getCell(index).trySetValue(symbol)) {
// on tente de placer sur la case suivante
if (solve(sudoku, index + 1)) {
return true;
@@ -34,7 +33,7 @@ public class StupidSolver {
}
}
// on a tout essayé et rien n'a fonctionné
sudoku.clearCell(coords.getX(), coords.getY());
sudoku.getCell(index).empty();
return false;
}