@@ -3,8 +3,15 @@
|
||||
*/
|
||||
package sudoku;
|
||||
|
||||
import sudoku.constraint.BlockConstraint;
|
||||
import sudoku.constraint.ColumnConstraint;
|
||||
import sudoku.constraint.IConstraint;
|
||||
import sudoku.constraint.LineConstraint;
|
||||
import sudoku.io.SudokuPrinter;
|
||||
import sudoku.io.SudokuSerializer;
|
||||
import sudoku.solver.Solver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Main {
|
||||
public String getGreeting() {
|
||||
@@ -13,5 +20,54 @@ public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new Main().getGreeting());
|
||||
int blockWidth = 2;
|
||||
int blockHeight = 2;
|
||||
var multidoku = SudokuFactory.createBasicEmptyRectangleSudoku(blockWidth, blockHeight);
|
||||
var sudoku = multidoku.getSubGrid(0);
|
||||
//SudokuPrinter.printRectangleSudoku(sudoku, blockWidth , blockHeight);
|
||||
//Line 1:
|
||||
((MutableCell)sudoku.getCell(0)).setSymbolIndex(0);
|
||||
((MutableCell)sudoku.getCell(1)).setSymbolIndex(1);
|
||||
((MutableCell)sudoku.getCell(2)).setSymbolIndex(2);
|
||||
((MutableCell)sudoku.getCell(3)).setSymbolIndex(3);
|
||||
//Line 2:
|
||||
((MutableCell)sudoku.getCell(4)).setSymbolIndex(2);
|
||||
((MutableCell)sudoku.getCell(5)).setSymbolIndex(3);
|
||||
((MutableCell)sudoku.getCell(6)).setSymbolIndex(0);
|
||||
((MutableCell)sudoku.getCell(7)).setSymbolIndex(1);
|
||||
//Line 3:
|
||||
((MutableCell)sudoku.getCell(8)).setSymbolIndex(1);
|
||||
((MutableCell)sudoku.getCell(9)).setSymbolIndex(0);
|
||||
((MutableCell)sudoku.getCell(10)).setSymbolIndex(3);
|
||||
((MutableCell)sudoku.getCell(11)).setSymbolIndex(2);
|
||||
// Line 4
|
||||
((MutableCell)sudoku.getCell(12)).setSymbolIndex(3);
|
||||
((MutableCell)sudoku.getCell(13)).setSymbolIndex(2);
|
||||
((MutableCell)sudoku.getCell(14)).setSymbolIndex(1);
|
||||
((MutableCell)sudoku.getCell(15)).setSymbolIndex(0);
|
||||
|
||||
SudokuPrinter.printRectangleSudoku(multidoku.getSubGrid(0), blockWidth , blockHeight);
|
||||
|
||||
ArrayList<IConstraint> constraints = new ArrayList<>();
|
||||
constraints.add(new LineConstraint());
|
||||
constraints.add(new ColumnConstraint());
|
||||
constraints.add(new BlockConstraint());
|
||||
|
||||
System.out.println(sudoku.isValid(constraints));
|
||||
|
||||
/*
|
||||
Solver solver = new Solver();
|
||||
ArrayList<IConstraint> constraints = new ArrayList<>();
|
||||
constraints.add(new LineConstraint());
|
||||
constraints.add(new ColumnConstraint());
|
||||
constraints.add(new BlockConstraint());
|
||||
try {
|
||||
solver.solve(multidoku, constraints);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user