Declaration
public NeighborSumConstraint(
bool isCol,
int rowCol,
int[] clue,
IEnumerable<UniquenessConstraint> furtherRestrictions = null,
int gridWidth = 9,
int gridHeight = 9,
int minValue = 1,
int maxValue = 9
)Summary
Describes a constraint as used in Neighbor Sum Sudoku by Timwi
(https://logic-masters.de/Raetselportal/Raetsel/zeigen.php?id=0005NV): Each number outside the grid gives the sum
of all orthogonal neighbors of one cell in the corresponding row or column. Where multiple numbers are given, the
sums must be in the same order as the clues.
Parameters
| bool | isCol |
If true, the constraint applies to a column; otherwise a row. |
| int | rowCol |
The row or column (depending on isCol). |
| int[] | clue |
The set of neighbor sums. Currently only 1 or 2 numbers are supported. |
| IEnumerable<UniquenessConstraint> | furtherRestrictions |
Pass in a UniquenessConstraint collection to restrict the number of combinations generated. This can
yield profound improvements in the speed of finding solutions. For example, you can construct a Sudoku instance, then construct this NeighborSumConstraint by passing in
sudoku.Constraints.OfType<UniquenessConstraint>(). |
| int | gridWidth |
The width of the grid (default: 9). |
| int | gridHeight |
The height of the grid (default: 9). |
| int | minValue |
Specifies the smallest value used in this puzzle. |
| int | maxValue |
Specifies the largest value used in this puzzle. |
Remarks
This is implemented as a
CombinationsConstraint, which may make it very memory-intensive on
oversized puzzles.