begin multidoku display code

This commit is contained in:
2025-01-26 22:19:56 +01:00
parent 3bb610b9c2
commit 3a0279afe3
5 changed files with 190 additions and 25 deletions

View File

@@ -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);