begin multidoku display code
This commit is contained in:
@@ -15,6 +15,7 @@ public class Sudoku {
|
||||
private final List<Cell> cells;
|
||||
private final List<IConstraint> constraints;
|
||||
private boolean isMutable;
|
||||
private int blockWidth;
|
||||
|
||||
public Sudoku(List<Cell> cells, List<Block> blocks, List<IConstraint> constraints) {
|
||||
this.cells = cells;
|
||||
@@ -23,7 +24,7 @@ public class Sudoku {
|
||||
}
|
||||
|
||||
public int[] toCoords(int index) {
|
||||
return new int[]{index % getSize(), index / getSize()};
|
||||
return new int[] { index % getSize(), index / getSize() };
|
||||
}
|
||||
|
||||
public int toIndex(int x, int y) {
|
||||
@@ -71,6 +72,10 @@ public class Sudoku {
|
||||
}
|
||||
}
|
||||
|
||||
public int getBlockWidth() {
|
||||
return blockWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to place a cell at the given coordinate
|
||||
*
|
||||
@@ -162,6 +167,8 @@ public class Sudoku {
|
||||
throw new Exception("The given cell is not in this sudoku.");
|
||||
}
|
||||
|
||||
// TODO: use this.cells.indexOf();
|
||||
|
||||
for (Cell cell : this.cells) {
|
||||
if (cell == c) {
|
||||
return new Coordinate(x, y);
|
||||
|
||||
Reference in New Issue
Block a user