This commit is contained in:
@@ -46,13 +46,19 @@ public class Sudoku {
|
||||
return index < getSize() * getSize();
|
||||
}
|
||||
|
||||
public boolean tryPlaceCellSymbol(int x, int y, int value) {
|
||||
assert (isValidCoords(x, y));
|
||||
public boolean canBePlaced(int x, int y, int value) {
|
||||
for (IConstraint constraint : this.constraints) {
|
||||
if (!constraint.canBePlaced(this, x, y, value)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean tryPlaceCellSymbol(int x, int y, int value) {
|
||||
assert (isValidCoords(x, y));
|
||||
if (!canBePlaced(x, y, value))
|
||||
return false;
|
||||
Cell cell = getCell(x, y);
|
||||
cell.setSymbolIndex(value);
|
||||
return true;
|
||||
@@ -293,4 +299,9 @@ public class Sudoku {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setBlockWidth(int blockWidth) {
|
||||
this.blockWidth = blockWidth;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user