[][src]Module sudokugen::solver

Offers a function to help you solve sudoku puzzles. The solve function takes a sudoku puzzle and returns a new board with the solution, if there is one.

use sudokugen::solver::solve;
use sudokugen::board::Board;

let board: Board =
    ". . . | 4 . . | 8 7 .
     4 . 3 | . . . | . . .
     2 . . | . . 3 | . . 9
     ---------------------
     . . 6 | 2 . . | . . 7
     . . . | 9 . 6 | . . .
     3 . 9 | . 8 . | . . .
     ---------------------
     . . . | . . . | . 4 .
     8 7 2 | 5 . . | . . .
     . . . | 7 2 . | 6 . .
    "
       .parse()
       .unwrap();

assert_eq!(
    solve(&board).unwrap(),
    "695412873413879526287653419146235987728946135359187264561398742872564391934721658"
    .parse()
    .unwrap()
);

Modules

generator

Provides a function and a utility struct to help you generate new puzzles. The generate function takes the base size of the board (see Board::new for an explanation of base size) and returns a unique, minimal puzzle together with the solution for that puzzle.

Structs

UnsolvableError

An errror to reperesent that this board is not solvable in it's current state

Functions

solve

Helper function to solve a sudoku puzzle.