setCell function
All checks were successful
Linux arm64 / Build (push) Successful in 34s

This commit is contained in:
2025-01-21 20:58:24 +01:00
parent 25df004c3c
commit a981034030

View File

@@ -21,6 +21,19 @@ public class Sudoku {
this.constraints = constraints;
}
/**
* Try to place a cell at the given coordinate
* @return false if it can't be done
*/
public boolean setCellSymbol(int x, int y, int value) {
for (IConstraint constraint : this.constraints) {
if (!constraint.canBePlaced(this, x, y, value)) {
return false;
}
}
return true;
}
public Cell getCell(int x, int y) {
int index = y * getSize() + x;
assert(index < getSize() * getSize());