Merge branch 'master' of git.ale-pri.com:Ryuk/Sudoku
Some checks failed
Linux arm64 / Build (push) Has been cancelled
Some checks failed
Linux arm64 / Build (push) Has been cancelled
This commit is contained in:
@@ -3,6 +3,7 @@ package gui.menu;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.CancellationException;
|
||||
|
||||
import gui.ColorGenerator;
|
||||
@@ -12,7 +13,7 @@ import imgui.ImVec2;
|
||||
import imgui.ImVec4;
|
||||
import imgui.flag.ImGuiCol;
|
||||
import imgui.flag.ImGuiStyleVar;
|
||||
import sudoku.solver.StupidSolver;
|
||||
import sudoku.solver.Solver;
|
||||
import sudoku.structure.Block;
|
||||
import sudoku.structure.Cell;
|
||||
import sudoku.structure.MultiDoku;
|
||||
@@ -98,19 +99,18 @@ public class SudokuView extends BaseView {
|
||||
ImGui.beginDisabled();
|
||||
|
||||
if (ImGui.button("Résoudre")) {
|
||||
resolveThread = new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
doku.getSubGrid(0).clear();
|
||||
StupidSolver.solve(doku);
|
||||
Thread.sleep(200);
|
||||
} catch (CancellationException | InterruptedException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
}
|
||||
});
|
||||
|
||||
resolveThread = new Thread(() -> {
|
||||
try {
|
||||
Random rand = new Random();
|
||||
doku.getSubGrid(0).clear();
|
||||
Solver.solveRandom(doku, rand);
|
||||
Thread.sleep(200);
|
||||
} catch (CancellationException | InterruptedException e) {
|
||||
System.out.println("The user is bored !");
|
||||
}
|
||||
stopResolve();
|
||||
});
|
||||
}
|
||||
boolean wantsToStop = false;
|
||||
if (resolveThread != null && resolveThread.isAlive()){
|
||||
|
||||
Reference in New Issue
Block a user