Show / Hide Table of Contents

Class MaxCountPerColumnRule

Restricts that each column contains a max count of each value, as specified by the CountPerUniqueValue dictionary.

Inheritance
System.Object
MaxCountRule
MaxCountPerColumnRule
Implements
IMissingColumnValuesTracker
IRule
Inherited Members
MaxCountRule.GetPossibleValues(Coordinate)
MaxCountRule.Revert(Coordinate, Int32)
MaxCountRule.Revert(Coordinate, Int32, CoordinateTracker)
MaxCountRule.Update(Coordinate, Int32, CoordinateTracker)
MaxCountRule.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 MaxCountPerColumnRule : MaxCountRule, IMissingColumnValuesTracker, IRule

Constructors

| Improve this Doc View Source

MaxCountPerColumnRule()

Declaration
public MaxCountPerColumnRule()

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

GetMissingValuesForColumn(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
| 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
MaxCountRule.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
MaxCountRule.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
MaxCountRule.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

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