feat: select solve algorithm
All checks were successful
Linux arm64 / Build (push) Successful in 25m12s
All checks were successful
Linux arm64 / Build (push) Successful in 25m12s
This commit is contained in:
@@ -66,34 +66,64 @@ public class SudokuView extends BaseView {
|
||||
stopResolve();
|
||||
}
|
||||
|
||||
private void renderSolvePopup() {
|
||||
if (ImGui.beginPopup("solve")) {
|
||||
if (ImGui.button("Résoudre avec backtrace")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Solver.randomSolve(doku, rand);
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
if (ImGui.button("Résoudre avec déduction")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Solver.humanSolve(doku);
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
if (ImGui.button("Résoudre avec déduction et backtrace")) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Solver.mixedSolve(doku, rand);
|
||||
} catch (CancellationException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
ImGui.closeCurrentPopup();
|
||||
}
|
||||
ImGui.endPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderSolveButton() {
|
||||
if (resolveThread != null)
|
||||
ImGui.beginDisabled();
|
||||
|
||||
boolean beginSolve = false;
|
||||
|
||||
if (!resolved && centeredButton("Résoudre")) {
|
||||
beginSolve = true;
|
||||
if (!this.resolved && centeredButton("Résoudre")) {
|
||||
// beginSolve = true;
|
||||
ImGui.openPopup("solve");
|
||||
}
|
||||
|
||||
if (resolveThread != null)
|
||||
ImGui.endDisabled();
|
||||
|
||||
if (beginSolve) {
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
Solver.randomSolve(doku, rand);
|
||||
Thread.sleep(200);
|
||||
} catch (CancellationException | InterruptedException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
}
|
||||
|
||||
if (resolved) {
|
||||
if (this.resolved) {
|
||||
ImGui.text("Bravo !");
|
||||
}
|
||||
|
||||
renderSolvePopup();
|
||||
}
|
||||
|
||||
private void renderSaveButton() {
|
||||
|
||||
Reference in New Issue
Block a user