module Sudoku::Solver
Overview
The Sudoku::Solver
module contains methods to solve sudoku puzzles.
Defined in:
sudoku-solver.crsudoku-solver/version.cr
Constant Summary
-
VERSION =
"0.1.0"
Class Method Summary
-
.solve(board : Sudoku::Board) : Bool
Tries to solve a sudoku puzzle in place.
Class Method Detail
def self.solve(board : Sudoku::Board) : Bool
#
Tries to solve a sudoku puzzle in place.
Example:
input = [
[5, 3, 0, 0, 7, 0, 0, 0, 0],
[6, 0, 0, 1, 9, 5, 0, 0, 0],
[0, 9, 8, 0, 0, 0, 0, 6, 0],
[8, 0, 0, 0, 6, 0, 0, 0, 3],
[4, 0, 0, 8, 0, 3, 0, 0, 1],
[7, 0, 0, 0, 2, 0, 0, 0, 6],
[0, 6, 0, 0, 0, 0, 2, 8, 0],
[0, 0, 0, 4, 1, 9, 0, 0, 5],
[0, 0, 0, 0, 8, 0, 0, 7, 9]
]
board = Sudoku::Board.new(input)
Sudoku::Solver.solve(board) # => true