Skip to content

bpeebles/sudoku.py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple code golfing Sudoku solver in Python

A while ago (back in 2015) I decided to try to code golf a Sudoku solver in Python. This is the result.

The sudoku.py file is partially minimized (short variable names) but with some comments and spacing. While sudoku_min.py is minified by hand, for now. Example runs:

$ python sudoku.py 123456789456789123789123456000000000000000000000000000000000000000000000000000000
123456789456789123789123456214365897365897214897214365531642978642978531978531642

# This one takes quite a while for my solver, almost a minute using a recent PyPy
$ python sudoku.py 850002400720000009004000000000107002305000900040000000000080070017000000000036040
859612437723854169164379528986147352375268914241593786432981675617425893598736241

and it prints the solution it found.

Size

As of when this README was last updated, the minified version is 375 bytes. The smallest I could find is 169 bytes at ShortestSudokuSolver. But I’m still fairly happy with it overall.

Read more

Author

Byron Peebles, 2015–2021.

About

Small, simple Sudoku solver in Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages