Packages

Sudoku solver in Elixir, which prefers to use heuristics over guessing

Current section

Files

Jump to
sudoku lib sudoku.ex
Raw

lib/sudoku.ex

defmodule Sudoku do
alias Sudoku.Strategy
@doc """
Entry point to solve a sudoku board
Pass in a bitstring where 0, dot, or space is a blank and any other symbol is a board symbol
Returns: {status, inferences, final_board}
Note: In the event of a non unique solution, the solver will stop at the first solution found.
To continue simply extract the state from the final_board.backtrack and pass this back to solve/1 to
get more solutions (or :invalid if no more solutions to be found)
"""
def solve(initial) do
Strategy.solve(initial)
end
end