Compare commits
No commits in common. "ffd1d4bd518f3fffea211568f2552a206ca04641" and "26df774ca35d68ba7a937c0f77a8ddf59ce68b81" have entirely different histories.
ffd1d4bd51
...
26df774ca3
2 changed files with 1 additions and 11 deletions
|
@ -127,15 +127,6 @@ public class SudokuController {
|
||||||
|
|
||||||
// Update the model and view
|
// Update the model and view
|
||||||
model.set(row, col, value);
|
model.set(row, col, value);
|
||||||
|
|
||||||
// Warn if the board is not solvable (e.g. if the user has made a mistake)
|
|
||||||
// This is very messy, error prone and computationally expensive
|
|
||||||
if(!model.isSolvable()) {
|
|
||||||
model.set(row, col, 0);
|
|
||||||
view.showErrorMessage("Illegal move. The board is not solvable.");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sync the view with the model
|
|
||||||
view.updateView(model.getBoard());
|
view.updateView(model.getBoard());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,7 @@ class SolverTest {
|
||||||
assertTrue(solver.isLegal(0, 0, 1));
|
assertTrue(solver.isLegal(0, 0, 1));
|
||||||
solver.set(0, 0, 1);
|
solver.set(0, 0, 1);
|
||||||
|
|
||||||
// Start from one, since setting the same value is legal
|
IntStream.range(0, 9).forEach(i -> {
|
||||||
IntStream.range(1, 9).forEach(i -> {
|
|
||||||
assertFalse(solver.isLegal(0, i, 1));
|
assertFalse(solver.isLegal(0, i, 1));
|
||||||
assertFalse(solver.isLegal(i, 0, 1));
|
assertFalse(solver.isLegal(i, 0, 1));
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue