This commit is contained in:
@@ -10,9 +10,9 @@ import imgui.ImVec2;
|
||||
import imgui.ImVec4;
|
||||
import imgui.flag.ImGuiCol;
|
||||
import imgui.flag.ImGuiStyleVar;
|
||||
import sudoku.Block;
|
||||
import sudoku.Cell;
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Block;
|
||||
import sudoku.structure.Cell;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class SudokuRenderer {
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ import imgui.ImVec2;
|
||||
import imgui.ImVec4;
|
||||
import imgui.flag.ImGuiCol;
|
||||
import imgui.flag.ImGuiStyleVar;
|
||||
import sudoku.Block;
|
||||
import sudoku.Cell;
|
||||
import sudoku.MultiDoku;
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.SudokuFactory;
|
||||
import sudoku.structure.Block;
|
||||
import sudoku.structure.Cell;
|
||||
import sudoku.structure.MultiDoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
import sudoku.structure.SudokuFactory;
|
||||
|
||||
public class SudokuView extends BaseView {
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package sudoku;
|
||||
|
||||
public class ImmutableCell extends Cell {
|
||||
|
||||
public ImmutableCell(int symbolIndex) {
|
||||
super(symbolIndex);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
package sudoku;
|
||||
|
||||
import sudoku.io.SudokuPrinter;
|
||||
import sudoku.structure.SudokuFactory;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package sudoku.constraint;
|
||||
|
||||
import sudoku.Block;
|
||||
import sudoku.Cell;
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Block;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class BlockConstraint implements IConstraint{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package sudoku.constraint;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class ColumnConstraint implements IConstraint {
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package sudoku.constraint;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public interface IConstraint {
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package sudoku.constraint;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class LineConstraint implements IConstraint {
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package sudoku.io;
|
||||
|
||||
import sudoku.MultiDoku;
|
||||
|
||||
public class SudokuFile {
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package sudoku.io;
|
||||
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class SudokuPrinter {
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package sudoku.io;
|
||||
|
||||
import sudoku.MultiDoku;
|
||||
|
||||
public class SudokuSave {
|
||||
|
||||
public static enum AlgoResolution {
|
||||
|
||||
@@ -6,11 +6,10 @@ import java.util.List;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import sudoku.Block;
|
||||
import sudoku.Cell;
|
||||
import sudoku.ImmutableCell;
|
||||
import sudoku.MultiDoku;
|
||||
import sudoku.Sudoku;
|
||||
import sudoku.structure.Block;
|
||||
import sudoku.structure.Cell;
|
||||
import sudoku.structure.MultiDoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
|
||||
public class SudokuSerializer {
|
||||
|
||||
@@ -44,7 +43,7 @@ public class SudokuSerializer {
|
||||
JSONObject cellJsonObject = new JSONObject();
|
||||
cellJsonObject.put("blockID", blockID);
|
||||
cellJsonObject.put("symboleIndex", symboleIndex);
|
||||
if (cell instanceof ImmutableCell) {
|
||||
if (!cell.isMutable()) {
|
||||
cellJsonObject.put("immutable", true);
|
||||
}
|
||||
jsonCells.put(cellJsonObject);
|
||||
@@ -111,7 +110,7 @@ public class SudokuSerializer {
|
||||
JSONObject entry = cellsJson.getJSONObject(i);
|
||||
int symboleIndex = entry.getInt("symboleIndex");
|
||||
if (entry.has("immutable")) {
|
||||
cells.add(new ImmutableCell(symboleIndex));
|
||||
cells.add(new Cell(symboleIndex, false));
|
||||
} else {
|
||||
cells.add(new Cell(symboleIndex));
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package sudoku.solver;
|
||||
|
||||
import sudoku.MultiDoku;
|
||||
import sudoku.Cell;
|
||||
import sudoku.io.SudokuPrinter;
|
||||
import sudoku.structure.MultiDoku;
|
||||
import sudoku.structure.Cell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -21,6 +21,12 @@ public class Cell {
|
||||
this.possibleSymbols = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Cell(int symbolIndex, boolean isMutable) {
|
||||
this.symbolIndex = symbolIndex;
|
||||
this.possibleSymbols = new ArrayList<>();
|
||||
this.isMutable = isMutable;
|
||||
}
|
||||
|
||||
public int getSymbolIndex() {
|
||||
return this.symbolIndex;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
public class Coordinate {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -1,4 +1,4 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
import sudoku.constraint.IConstraint;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package sudoku;
|
||||
package sudoku.structure;
|
||||
|
||||
import sudoku.constraint.BlockConstraint;
|
||||
import sudoku.constraint.ColumnConstraint;
|
||||
import sudoku.constraint.IConstraint;
|
||||
import sudoku.constraint.LineConstraint;
|
||||
import sudoku.structure.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -8,6 +8,8 @@ import org.junit.jupiter.api.Test;
|
||||
|
||||
import sudoku.io.SudokuPrinter;
|
||||
import sudoku.io.SudokuSerializer;
|
||||
import sudoku.structure.MultiDoku;
|
||||
import sudoku.structure.SudokuFactory;
|
||||
|
||||
public class SudokuSerializerTest {
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package sudoku.solver;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sudoku.*;
|
||||
import sudoku.io.SudokuPrinter;
|
||||
import sudoku.structure.Cell;
|
||||
import sudoku.structure.MultiDoku;
|
||||
import sudoku.structure.Sudoku;
|
||||
import sudoku.structure.SudokuFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user