Interface IHeuristic
Performs some logical trickery to reduce the number of possible values for a square. Unlike an IRule, this depends on the current possible values in the puzzle, not just the currently set values.
Namespace: SudokuSpice.RuleBased.Heuristics
Assembly: SudokuSpice.dll
Syntax
public interface IHeuristic
Methods
| Improve this Doc View SourceCopyWithNewReferences(IReadOnlyPuzzleWithMutablePossibleValues, ReadOnlySpan<IRule>)
Creates a deep copy of this heuristic, replacing internal references with the ones provided. These references may or may not be used during the copy, depending on the implementation of the heuristic.
Declaration
IHeuristic CopyWithNewReferences(IReadOnlyPuzzleWithMutablePossibleValues puzzle, ReadOnlySpan<IRule> rules)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyPuzzleWithMutablePossibleValues | puzzle | |
System.ReadOnlySpan<IRule> | rules |
Returns
Type | Description |
---|---|
IHeuristic |
TryInitFor(IReadOnlyPuzzleWithMutablePossibleValues)
Tries to initialize this heuristic for solving the given puzzle.
Declaration
bool TryInitFor(IReadOnlyPuzzleWithMutablePossibleValues puzzle)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyPuzzleWithMutablePossibleValues | puzzle | The puzzle to solve. |
Returns
Type | Description |
---|---|
System.Boolean | False if this heuristic cannot be initialized for the given puzzle, else true. |
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 heuristic's state is unchanged on failure.
UndoLastUpdate()
Undoes the last modifications made by this heuristic.
Declaration
void UndoLastUpdate()
UpdateAll()
Updates all the current possible values.
Declaration
bool UpdateAll()
Returns
Type | Description |
---|---|
System.Boolean | Returns true if any modifications were made. |