feat: add history

This commit is contained in:
2025-02-01 22:54:02 +01:00
parent 3e30332245
commit 78bdefebe5
6 changed files with 54 additions and 15 deletions

View File

@@ -15,7 +15,7 @@ public class BacktrackingSolver implements Solver {
* @return boolean, valant true si le MultiDoku est résolu, false sinon.
*/
@Override
public boolean solve(MultiDoku doku) {
public boolean solve(MultiDoku doku, List<SolverStep> steps) {
if (Thread.interrupted())
throw new CancellationException("User wants to stop the solver");
@@ -34,14 +34,14 @@ public class BacktrackingSolver implements Solver {
}
for (int symbol : possibleSymbols) {
cellToFill.setSymbolIndex(symbol);
addStep(cellToFill, steps);
if (this.solve(doku)) {
return true;
} else {
cellToFill.setSymbolIndex(Cell.NOSYMBOL);
addStep(cellToFill, steps);
}
}
return false;
}