This commit is contained in:
@@ -21,6 +21,19 @@ public class Sudoku {
|
|||||||
this.constraints = constraints;
|
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) {
|
public Cell getCell(int x, int y) {
|
||||||
int index = y * getSize() + x;
|
int index = y * getSize() + x;
|
||||||
assert(index < getSize() * getSize());
|
assert(index < getSize() * getSize());
|
||||||
|
|||||||
Reference in New Issue
Block a user