Skip to content
This repository has been archived by the owner on Feb 18, 2018. It is now read-only.

judwhite/go-sudoku

Repository files navigation

go-sudoku

go-sudoku is an entry for Go Challenge 8.

Run

go-sudoku < input.txt

or, more interestingly:

go-sudoku -steps < input.txt

See example

Board input format

1 _ 3 _ _ 6 _ 8 _
_ 5 _ _ 8 _ 1 2 _
7 _ 9 1 _ 3 _ 5 6
_ 3 _ _ 6 7 _ 9 _
5 _ 7 8 _ _ _ 3 _
8 _ 1 _ 3 _ 5 _ 7
_ 4 _ _ 7 8 _ 1 _
6 _ 8 _ _ 2 _ 4 _
_ 1 2 _ 4 5 _ 7 8

Additional arguments

Run go-sudoku -help for a full list of optional arguments.

Argument Description
-time print time to solve
-steps print steps an explanations to solve and eliminate candidates
-generate generate a sudoku puzzle (unfortunately no difficulty selection)
-profile enable CPU and memory profiling
-file run a set of Sudoku puzzles from a file
-max-puzzles use with -file to limit the number of puzzles executed

How it works

go-sudoku first attempts human strategy and ultimately falls back on a SAT solver.

The SAT solver takes advantage of some Sudoku characteristics to shorten execution time. It's rather good at determining unsolvable boards.

Resources

About

Sudoku solver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published