difficulties
All checks were successful
Linux arm64 / Build (push) Successful in 52s

This commit is contained in:
2025-01-29 11:47:18 +01:00
parent a221233c06
commit 4190bf15d8
3 changed files with 22 additions and 37 deletions

View File

@@ -2,10 +2,8 @@ package gui.menu;
import imgui.ImGui;
import imgui.type.ImInt;
import sudoku.solver.Solver;
import sudoku.structure.Cell;
import sudoku.structure.Difficulty;
import sudoku.structure.MultiDoku;
import sudoku.structure.Sudoku;
import sudoku.structure.SudokuFactory;
public class SoloMenu extends BaseView {
@@ -26,20 +24,7 @@ public class SoloMenu extends BaseView {
private void pushSudokuState(MultiDoku doku, boolean empty) {
if (!empty) {
try {
int level = 0;
for (Sudoku sudoku : doku.getSubGrids()) {
level += sudoku.getSize() * sudoku.getSize() / 10 * 3;
}
Solver.solve(doku);
level = (level - 1) / doku.getNbSubGrids();
SudokuFactory.newDokuFromFilledOne(doku, level);
for (Sudoku sudoku : doku.getSubGrids()) {
for (Cell cell : sudoku.getCells()) {
if (cell.getSymbolIndex() != Cell.NOSYMBOL) {
cell.setImmutable();
}
}
}
SudokuFactory.fillDoku(doku, Difficulty.Easy);
} catch (Exception e) {
e.printStackTrace();
}