Show / Hide Table of Contents

Class BoxUniquenessRule

Restricts that each 'box' contains all unique values.

Inheritance
System.Object
UniquenessRule
BoxUniquenessRule
Implements
IMissingBoxValuesTracker
IRule
Inherited Members
UniquenessRule.GetPossibleValues(Coordinate)
UniquenessRule.Revert(Coordinate, Int32)
UniquenessRule.Revert(Coordinate, Int32, CoordinateTracker)
UniquenessRule.Update(Coordinate, Int32, CoordinateTracker)
UniquenessRule.GetPossibleValues(Int32)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SudokuSpice.RuleBased.Rules
Assembly: SudokuSpice.dll
Syntax
public class BoxUniquenessRule : UniquenessRule, IMissingBoxValuesTracker, IRule

Constructors

| Improve this Doc View Source

BoxUniquenessRule()

Declaration
public BoxUniquenessRule()

Methods

| Improve this Doc View Source

CopyWithNewReference(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
UniquenessRule.CopyWithNewReference(IReadOnlyPuzzle)
| Improve this Doc View Source

GetDimension(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
UniquenessRule.GetDimension(Coordinate)
| Improve this Doc View Source

GetMissingValuesForBox(Int32)

Returns all the values that still need to be set in the given box.

Declaration
public BitVector GetMissingValuesForBox(int box)
Parameters
Type Name Description
System.Int32 box
Returns
Type Description
BitVector
| Improve this Doc View Source

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
UniquenessRule.GetNumDimensions(IReadOnlyPuzzle)
| Improve this Doc View Source

TrackUnsetCoordinatesOnSameDimension(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
UniquenessRule.TrackUnsetCoordinatesOnSameDimension(Int32, Coordinate, CoordinateTracker)
| Improve this Doc View Source

TryInit(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
UniquenessRule.TryInit(IReadOnlyPuzzle, BitVector)
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.

Implements

IMissingBoxValuesTracker
IRule
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX