A sudoku solver library

16 unstable releases (6 breaking)

0.7.0 Oct 19, 2018
0.6.2 Jun 24, 2018
0.6.0 May 31, 2018
0.5.0 Feb 14, 2018
0.1.3 Jun 6, 2015
Download history 4/week @ 2018-12-14 161/week @ 2018-12-21 4/week @ 2018-12-28 17/week @ 2019-01-04 4/week @ 2019-01-11 2/week @ 2019-01-18 3/week @ 2019-01-25 4/week @ 2019-02-01 1/week @ 2019-02-15 3/week @ 2019-02-22 34/week @ 2019-03-01 18/week @ 2019-03-08 4/week @ 2019-03-15 212/week @ 2019-03-22

227 downloads per month


3.5K SLoC

Sudoku Status Build Status

Utilities for classical 9x9 sudokus.

This library currently offers extremely fast sudoku solving, a basic sudoku generator and a prototype solver using human strategies. The fast solver is based on jczsolve which is currently and to the best knowledge of the author the world's fastest sudoku solver algorithm. A few modifications were made to improve the speed further. The strategy solver is capable of applying a few simple strategies, namely naked and hidden singles, locked candidates, naked and hidden subsets (Pairs, Triples, Quads) and basic fish (X-Wing, Swordfish, Jellyfish). An explanation of these strategies and more can be found at

A future goal is the extension and further optimization of the strategy solver, so that most sudokus can be graded, hinted and the solution path explained. With the ability to grade sudokus, puzzles of any desired desired difficulty can also be generated.


use sudoku::Sudoku;

// Sudokus can be created from &str's in both block or line formats or directly from bytes.
// here, an example in line format
let sudoku_line = "...2...633....54.1..1..398........9....538....3........263..5..5.37....847...1...";

let sudoku = Sudoku::from_str_line(sudoku_line).unwrap();

// Solve, print or convert the sudoku to another format
if let Some(solution) = sudoku.solve_unique() {
    // print the solution in line format
    println!("{}", solution);

    // or return it as a byte array
    let cell_contents: [u8; 81] = solution.to_bytes();