fix: serialize
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user