Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Class: PuzzleSolvers.BattlefieldUniquenessConstraint

Summary

Describes a “battlefield” constraint: the first and last number in the region represent the sizes of two armies, who march inward; the clue specifies the sum of the digits that are sandwiched between the armies or that are within the armies’ overlap. This constraint implies a uniqueness constraint.

Remarks

Warning: This constraint is very memory-intensive. It is implemented as a CombinationsConstraint with all of the possible number combinations for the specified set of cells. Avoid using this on oversized puzzles. (At time of writing, this is only feasible for up to 11 cells, which uses about 2 GB of RAM for each constraint.)

Constructors

BattlefieldUniquenessConstraint(int clue, IEnumerable<int> affectedCells, int minValue = 1, int maxValue = 9)
Constructor.

Static methods

intCalculates what the Battlefield clue would be for a given row of numbers.
int[][]
GenerateCombinations(int minValue, int maxValue, int clue, int numAffectedCells)
Generates (and caches) all possible combinations of digits that satisfy a given Battlefield clue.
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.
stringOverride.

Instance properties

int[]The group of cells affected by this constraint, or null if it affects all of them.
boolOverride; see base.
intThe sum of the digits sandwiched or overlapped.
int?[][]The set of combinations allowed for the specified set of cells.
int?Override; see base.