Sudoku Py / C++11 / D?
Jonathan M Davis
jmdavisProg at gmx.com
Wed Aug 15 13:28:07 PDT 2012
On Wednesday, August 15, 2012 21:14:07 Era Scarecrow wrote:
> I have made a C version a while back that solves any sudoku
> puzzle in 1/8th of a second. The code for that though was
> considerably longer and involved several forms of pattern
> matching and detecting how to solve the puzzle before it went to
> brute force as a last resort.
Brute force is so fast that there's no really any point in trying to solve it
any other way except for the challenge of doing so. I answered a question on
this using D at codegolf.stackexchange.com a while back:
http://codegolf.stackexchange.com/questions/378/implement-a-brute-force-
sudoku-solver/402#402
and the code is lightning fast. It would probably have to be tweaked to match
whatever Bearophile's code does though as far is input goes (I haven't looked
at the code that he linked to). It also makes no attempt at being compact
(e.g. it actually checks the command line arguments). It's at just over 150
lines and could be much shorter if I really tried to properly golf it rather
than just solve the problem.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list