Module sudoku_variants::solver[][src]

This module contains the logic for solving Sudoku.

Most importantly, this module contains the definition of the Solver trait and the BacktrackingSolver as a generally usable implementation.

Modules

strategy

This module is about strategic solving of Sudoku. In contrast to backtracking, this is often faster, but cannot solve all Sudoku. However, strategic backtracking is also possible, which still uses backtracking, but also uses strategies to reduce the search space. This is solely a performance optimization and offers no functional advantage over pure backtracking. For more information, view the StrategicBacktrackingSolver.

Structs

BacktrackingSolver

A perfect Solver which solves Sudoku by recursively testing all valid numbers for each cell. This means two things:

Enums

Solution

An enumeration of the different ways a Sudoku can be solveable. Note that this may be relative to the solver, since an imperfect solver may be unable to continue at some point, yielding Solution::Ambiguous, where the Sudoku is actually uniquely solveable or impossible.

Traits

Solver

A trait for structs which have the ability to solve Sudoku. Not all implementers must be able to find a unique solution to every uniquely solveable Sudoku, some solvers may be less powerful, similar to a less experienced human solver. This may make sense to check whether some Sudoku is solveable using some strategy.