Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: PuzzleSolvers.NoConsecutiveConstraint

Summary

Describes a constraint in a number-placement grid puzzle where no adjacent cells can have numerically consecutive values.

Constructors

NoConsecutiveConstraint(int gridWidth, int gridHeight, bool includeDiagonals, int[] affectedValues = null, IEnumerable<int> enforcedCells = null, bool enforcedCellsOnly = false)
Constructor.

Static methods

IEnumerable<int>
AdjacentCells(int cell, int gridWidth, int gridHeight, bool includeDiagonals)
Returns the set of cells adjacent to the specified cell.
int
TranslateCoordinate(string str, int gridWidth = 9)
Converts a convenient coordinate notation into a puzzle-grid index.
IEnumerable<int>
TranslateCoordinates(string str, int gridWidth = 9)
Converts a convenient coordinate notation into puzzle-grid indices.

Instance methods

ConstraintResultOverride; see base.

Instance properties

int[]The group of cells affected by this constraint, or null if it affects all of them.
int[] If not null, the constraint is limited to these values in the grid. This must include all affected consecutive digits; for example, if this contains 2 and 3, then 1 and 2 can still be adjacent. If this contains a single digit, the constraint is entirely ineffectual.
bool By default, a constraint is only evaluated once for every digit placed in the grid, but not when another constraint merely rules out a possibility. Derived types can override this and return true to indicate to the solver that the constraint should be reevaluated (meaning: have Constraint.Process(SolverState) called on it again) when another constraint rules out a value in one of the affected cells of this constraint.
int[] Optionally specifies a limited set of cells on which the no-consecutive constraint is enforced. (see also remarks)
bool If true, only adjacent cells that are both within NoConsecutiveConstraint.EnforcedCells are enforced. Otherwise, cells outside of NoConsecutiveConstraint.EnforcedCells that are adjacent to a cell in NoConsecutiveConstraint.EnforcedCells are also enforced.
intThe height of the grid this constraint applies to.
intThe width of the grid this constraint applies to.
bool If true, the constraint also applies to cells diagonally adjacent to one another. If false, only orthogonally adjacent cells are affected.
int? Indicates an approximate number of possible combinations of digits this constraint can still accommodate. This will help the solver prioritize cells when multiple cells have the same number of combinations individually.