Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Abstract class: PuzzleSolvers.SolverState

Summary

Encapsulates information given to Constraint implementations (in a call to Constraint.Process(SolverState)) during the puzzle solving algorithm.

Instance methods

bool
AllSame<T>(int cell, Func<int, T> predicate, out T result)
  • Abstract
Determines if all values that are still possible in the specified cell have the same value when projected through the specified predicate. For example, this can be used to determine if all the values still possible are the same parity, or all primes/non-primes, etc.
bool
IsImpossible(int cell, int value)
  • Abstract
Determines if a specific value in a specific cell has already been marked impossible or is out of range.
void
MarkImpossible(int cell, int value)
  • Abstract
Marks a specific value in a specific cell as no longer possible.
void
MarkImpossible(int cell, Func<int, bool> isImpossible)
  • Abstract
Marks values in a specific cell as no longer possible that satisfy the given predicate isImpossible.
int
MaxPossible(int cell)
Returns the largest value that is still possible within the specified cell.
int
MinPossible(int cell)
Returns the smallest value that is still possible within the specified cell.
void
MustBe(int cell, int value)
  • Abstract
Marks a specific cell as having to contain a specific value.

Instance properties

int
  • Abstract
Returns the size of the puzzle being solved.
int?
this[int cell]
  • Abstract
Exposes read-only access to the incomplete solution at the current point during the algorithm. (see also remarks)
int?
  • Abstract
If not null, Constraint.Process(SolverState) was called immediately after placing a value in the cell given by this index. (This value may be tentative; if the algorithm finds it to be impossible, it will backtrack.) The implementation may examine deductions from just that one value. If null, the method may have been called (a) at the very start of the algorithm before placing any values; (b) after this constraint was returned from another constraint’s Constraint.Process(SolverState) call to replace it; or (c) if the constraint has Constraint.CanReevaluate and one of its affected cells has changed. In these cases, implementations should examine the whole set of affected cells for possible deductions.
int Returns the value stored in the cell given by SolverState.LastPlacedCell (see there for details). Throws an exception if SolverState.LastPlacedCell is null.
int
  • Abstract
The maximum value that squares can have in this puzzle. For standard Sudoku, this is 9.
int
  • Abstract
The minimum value that squares can have in this puzzle. For standard Sudoku, this is 1.