Solvers
Provides a collection of Sudoku solvers.
BasicSolver
BasicSolver(board: Board)
A basic Sudoku solver using a brute force backtracking algorithm.
This solver uses backtracking for the empty cells. Cells are processed left to right, top to bottom. It always picks the next higher valid value. The algorithm stops in case one valid solution is found. There is no check if there is another valid solution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
board |
Board
|
Board that should be solved. |
required |
solve
solve() -> Board
Search a valid solution of the board and returns the filled board.
Raises:
| Type | Description |
|---|---|
BoardNotSolvableException
|
If no valid solution for the board is found. |
Returns:
| Type | Description |
|---|---|
Board
|
A board filled with a valid solution. |