TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Sudoku Solving

111 pointsby nu2ycombinatorabout 14 years ago

14 comments

muhukabout 14 years ago
<p><pre><code> Why did I do this? As computer security expert Ben Laurie has stated, Sudoku is "a denial of service attack on human intellect". My wife was infected by the virus, and I wanted to convince her that the problem had been solved and didn't need any more of her time. </code></pre> Very true.
评论 #2371869 未加载
mberningabout 14 years ago
I remember doing something very similar in college. My first cut used a hideous object model, but my second go at it used a 3 dimensional matrix to track all of the data and was much faster and space efficient.<p>The "Why?" at the end of the article pretty much sums up why I can't play most board games and puzzles. Once you 'solve' sudoku, chess, connect 6, ect. it really takes the fun out of it, even if your brain doesn't calculate the solution as quick as your code.
评论 #2372050 未加载
评论 #2372130 未加载
roryokaneabout 14 years ago
Norvig tries to test his program against the hardest puzzle he can find, but only tries to find this hard puzzle by generating random ones. The program Sudoku Susser (<a href="http://www.madoverlord.com/projects/sudoku.t" rel="nofollow">http://www.madoverlord.com/projects/sudoku.t</a>) actually comes with “the hardest sudoku in the world”, which I think the author of that program has proven somehow, so Norvig should try his program on that.<p>Sudoku Susser can solve sudoku puzzles not only the brute-force way shown in the article, but also using “human” reasoning, and show you all the steps.
评论 #2372009 未加载
jonahabout 14 years ago
He could have used Mechanical Turk to solve them. ;)<p>Growing up, we had a favorite game. That is until my sister solved it in that going first you could <i>always</i> win. It wasn't as fun after that.
评论 #2371316 未加载
ozatamanabout 14 years ago
Would be interesting to see how this fares performance-wise in comparison:<p><a href="http://corp.galois.com/blog/2009/3/18/solving-sudoku-using-cryptol.html" rel="nofollow">http://corp.galois.com/blog/2009/3/18/solving-sudoku-using-c...</a><p>It's a sudoku solver based on Cryptol, which is "... a language tailored for cryptographic algorithms." built on top of Haskell. The amazing this is that all you need to define is a function that checks whether a given board is solved. Cryptol does the searching for you!
jwsabout 14 years ago
I find that calculating the sequence of stereo pairs for an MP3 file is much simpler and more accurate if I dispense with the human listener.<p>For instance, I just rendered "In the Year 2525" 593 times faster than a human can listen to it on a single thread of a core i3.
wallflowerabout 14 years ago
Reminds me of:<p><a href="http://blog.jgc.org/2010/01/more-fun-with-toys-ikea-lillabo-train.html" rel="nofollow">http://blog.jgc.org/2010/01/more-fun-with-toys-ikea-lillabo-...</a>
YuriNiyazovabout 14 years ago
Can someone explain the Ben Laurie quote? I know what Sudoku is, and I know what a DOS attack is. I don't see the connection between the two.
评论 #2371482 未加载
xtacyabout 14 years ago
If you really want speed, then I would recommend using a good implementation of Dancing Links for solving constraint satisfaction problems. Don Knuth proposes a doubly linked list structure to speed up recursive state space exploration: www-cs-faculty.stanford.edu/~uno/papers/dancing-color.ps.gz.
评论 #2373236 未加载
atuladharabout 14 years ago
I wrote one in JavaScript a long time ago, again using a simple backtracking algorithm.<p><a href="http://www.amrittuladhar.com/projects/sudokusolver/" rel="nofollow">http://www.amrittuladhar.com/projects/sudokusolver/</a><p>EDIT: Just realized the "load puzzle" feature doesn't seem to work on Chrome, but it does in other browsers.
jwsabout 14 years ago
Sadly it is a backtracking algorithm which is not proper Sudoku solving technique. (Opinions vary on the topic.)
评论 #2371443 未加载
isak2about 14 years ago
I wrote one in C# a while ago:<p><a href="http://isaksky.wordpress.com/2010/10/30/objected-oriented-solution-to-every-sudoku-puzzle-in-csharp/" rel="nofollow">http://isaksky.wordpress.com/2010/10/30/objected-oriented-so...</a>
评论 #2372034 未加载
akivabambergerabout 14 years ago
The answer is just 3 words: depth first search. I don't get why such a tedious article was written for such a simple, common, and obvious solution.
alienDeveloperabout 14 years ago
<a href="http://news.ycombinator.com/item?id=2374763" rel="nofollow">http://news.ycombinator.com/item?id=2374763</a><p>another php version