Documentation ¶
Overview ¶
Package solver provides the key functionality of this sudoku solver
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Solver ¶
Solver is the primary type for all functions. It consists of a collection of strategies to be used, the current fixed-state board (0=empty), a list ofboard candidates and a logger. The strategies will be called one at a time until one changes something, then the solver will start from the beginning.
func MakeSolver ¶
MakeSolver takes a board (0s used for empty cells) and a list of strategies and creates a new solver.
func (*Solver) EnoughCands ¶
EnoughCands checks to make sure that there is at least one copy of each digit available in the list of candidates for each row/column/box.
func (*Solver) IsLegal ¶
IsLegal checks the legality of the current board state of a solver, only verifies that no two copies of the same digit see each other.
func (*Solver) IsSolved ¶
IsSolved checks whether the sudoku is solved (assumes that the board is in a legal state)
func (*Solver) NakedSingles ¶
NakedSingles searches for naked singles and moves any that are found to the board, returns whether anything has been changed. Note: A naked single is the term for sudoku cells where there is exactly one candidate value remaining.
func (*Solver) RestrictCands ¶
RestrictCands removes candidates that see a copy of the digit in the same row/column/box, returns whether anything has been changed.