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