Function sudoku_solver::solver::solve [−][src]
Expand description
Solve a sudoku puzzle.
Returns an Option<Board>
which is either None
, if no solution could be found, or a Some
variant wrapping the first solution found.
Example
let board = Board::from(&[
[0, 0, 0, 2, 6, 0, 7, 0, 1], // row 1
[6, 8, 0, 0, 7, 0, 0, 9, 0], // row 2
[1, 9, 0, 0, 0, 4, 5, 0, 0], // row 3
[8, 2, 0, 1, 0, 0, 0, 4, 0], // row 4
[0, 0, 4, 6, 0, 2, 9, 0, 0], // row 5
[0, 5, 0, 0, 0, 3, 0, 2, 8], // row 6
[0, 0, 9, 3, 0, 0, 0, 7, 4], // row 7
[0, 4, 0, 0, 5, 0, 0, 3, 6], // row 8
[7, 0, 3, 0, 1, 8, 0, 0, 0], // row 9
]);
assert!(solve(&board).is_some());