Class ColumnUniquenessRule
Restricts that each column contains all unique values.
Inherited Members
Namespace: SudokuSpice.RuleBased.Rules
Assembly: SudokuSpice.dll
Syntax
public class ColumnUniquenessRule : UniquenessRule, IMissingColumnValuesTracker, IRule
Constructors
| Improve this Doc View SourceColumnUniquenessRule()
Declaration
public ColumnUniquenessRule()
Methods
| Improve this Doc View SourceCopyWithNewReference(IReadOnlyPuzzle)
Creates a deep copy of this IRule, with any internal IReadOnlyPuzzle
references updated to the given puzzle.
Declaration
public override IRule CopyWithNewReference(IReadOnlyPuzzle puzzle)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyPuzzle | puzzle | The new puzzle reference to use. To ensure this rule's internal state is correct, this puzzle should contain the same data as the current puzzle referenced by this rule. |
Returns
| Type | Description |
|---|---|
| IRule |
Overrides
| Improve this Doc View SourceGetDimension(Coordinate)
Gets the dimension for a coordinate.
Declaration
protected override int GetDimension(in Coordinate c)
Parameters
| Type | Name | Description |
|---|---|---|
| Coordinate | c |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
| Improve this Doc View SourceGetMissingValuesForColumn(Int32)
Returns all the values that still need to be set in the given column.
Declaration
public BitVector GetMissingValuesForColumn(int column)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | column |
Returns
| Type | Description |
|---|---|
| BitVector |
GetNumDimensions(IReadOnlyPuzzle)
Returns the number of dimensions that will be enforced to contain unique values.
Declaration
protected override int GetNumDimensions(IReadOnlyPuzzle puzzle)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyPuzzle | puzzle | The puzzle for which to determine the number of dimensions. |
Returns
| Type | Description |
|---|---|
| System.Int32 |
Overrides
| Improve this Doc View SourceTrackUnsetCoordinatesOnSameDimension(Int32, Coordinate, CoordinateTracker)
Adds the coordinates of unset values on the given dimension to the given tracker.
Declaration
protected override void TrackUnsetCoordinatesOnSameDimension(int dimension, in Coordinate source, CoordinateTracker tracker)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | dimension | The dimension to search. |
| Coordinate | source | The source coordinate for the change; should be skipped. |
| CoordinateTracker | tracker | The tracker to add coordiantes to. |
Overrides
| Improve this Doc View SourceTryInit(IReadOnlyPuzzle, BitVector)
Tries to initialize this rule to prepare to solve the given puzzle.
Declaration
public override bool TryInit(IReadOnlyPuzzle puzzle, BitVector uniquePossibleValues)
Parameters
| Type | Name | Description |
|---|---|---|
| IReadOnlyPuzzle | puzzle | The puzzle to be solved. |
| BitVector | uniquePossibleValues | All the unique possible values for this puzzle. |
Returns
| Type | Description |
|---|---|
| System.Boolean | False if the puzzle violates this rule and initialization fails, else true. |
Overrides
Remarks
In general, it doesn't make sense to want to maintain the previous state if this method fails. Therefore, it is not guaranteed that the rule's state is unchanged on failure.