User feedback on unsolvable

This commit is contained in:
Imbus 2023-12-11 13:12:50 +01:00
parent 2acf69d466
commit 3cf7005151

View file

@ -25,10 +25,16 @@ public class SudokuController {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
// Solve the board // Solve the board
model.solve(); boolean solved = model.solve();
if (!solved) {
view.showErrorMessage("Could not solve the board.");
System.out.println("Could not solve the board.");
System.out.println(model.toString());
} else {
// Update the view
view.updateView(model.getBoard());
}
// Update the view
view.updateView(model.getBoard());
} }
}); });