Live data from Hacker News

Solving Every Sudoku Puzzle (2006)

norvig.com

11–20 of 28 posts

Re: Solving Every Sudoku Puzzle (2006)

#11
I find it rather disappointing that it still takes on the order of 10^2 milliseconds to solve the hardest sudokus.

This was tested with my own algorithm and one supposedly fast found online. I will revise my code, but I doubt I will improve the speed.

Re: Solving Every Sudoku Puzzle (2006)

#12
post #2

This is good to know that we can win Sudoku with a computer program but not surprising. The goal of Sudoku is to make your intellect work and find logic by yourself. The article should be named: How to win every Sudoku puzzle by cheating.

I never solved a single Sudoku. I never will. Instead, I wrote a Sudoku solver.

What's better for the brain, solving Sudokus, or writing a Sudoku solver?

Re: Solving Every Sudoku Puzzle (2006)

#14
post #6
post #2

This is good to know that we can win Sudoku with a computer program but not surprising. The goal of Sudoku is to make your intellect work and find logic by yourself. The article should be named: How to win every Sudoku puzzle by cheating.

You're being short sighted: I find the endeavor of writing a program to solve sudoku much more intellectually interesting and challenging than solving each grid manually.

I never said that writing a program wasn't intellectual. I said that by using a program to solve your Sudoku problem, you would not think anymore. It's like if I win at Chess but I actually don't play, I just ask a program to show me my next moves. The person who created the program used its intellect but not the ones using the program.

Re: Solving Every Sudoku Puzzle (2006)

#15
I implemented a solver in Common Lisp, quite a while back. The repo:https://github.com/dmsurti/sudoku and some details here: http://www.deepaksurti.com/blog/my-attempt-to-solve-sudoku.

I was learning algorithms then and a sudoku solver was both fun and a good learning exercise.

Re: Solving Every Sudoku Puzzle (2006)

#16
post #2

This is good to know that we can win Sudoku with a computer program but not surprising. The goal of Sudoku is to make your intellect work and find logic by yourself. The article should be named: How to win every Sudoku puzzle by cheating.

I never solved a single Sudoku. I never will. Instead, I wrote a Sudoku solver. What's better for the brain, solving Sudokus, or writing a Sudoku solver?

>What's better for the brain, solving Sudokus, or writing a Sudoku solver?

Both can be good. Chances are that your first Sudoku solver uses some bruteforce approach, while your manual solution certainly does not. Then the intuitions that you get from many manual games can drive the design of your solver. Of course you can implement some established algorithm but I don't see that challenging.

I have mathematician friend who won't ever play Nine Men's Morris because it's a solved game, so it's not longer interesting for him. It's a shame, you can learn a lot even playing Nim variants if you don't already know the winning strategy, it's a good learning material for kids too.

Re: Solving Every Sudoku Puzzle (2006)

#17
post #5
post #2

This is good to know that we can win Sudoku with a computer program but not surprising. The goal of Sudoku is to make your intellect work and find logic by yourself. The article should be named: How to win every Sudoku puzzle by cheating.

My father, approaching 70, does Sudoku with his breakfast every morning to keep his mind sharp. I think it would be at least equally beneficial for him to learn Python and write a Sudoku solver in it, and since he knows nothing of programming I imagine this would keep him busy for quite some mornings.

You might want to tell him that the better he gets at solving sudoku, the less useful it will be for keeping his mind sharp. The cognitive science research seems to show that you only benefit from the challenge, so doing something that mentally challenges other people and used to challenge you won't benefit you if you have gotten good enough at it that it has become fairly easy--for you.

Instead, as you suggest, staving off cognitive decline might be better accomplished by learning some Python, learning a new language well enough to do some traveling or reading with it, learning to play a new musical instrument, learning some simple juggling, or whatever is both safe and more cognitively taxing than polishing an existing skill by repetition.

Re: Solving Every Sudoku Puzzle (2006)

#18
post #8

Another way to solve Sudoku is to understand that it is an instance of the Exact Cover problem [1]. Basically, solving a 3x3 Sudoku grid is nothing more than finding 9 "sheets" of each number which superimpose exactly on top of the grid. For example (2x2 sudoku = 4 sheets): 1324 3142 4213 2431 is: 1... .2.. .3.. ...4 .1.. ...2 3... ..4. ..1. + .2.. + ...3 + 4... ...1 2... ..3. .4.. or even: x... .x.. .x.. ...x .x.. .…

There is a very succinct implementation of Algorithm X in Python that uses a variation of the Dancing Links approach.

http://www.cs.mcgill.ca/~aassaf9/python/algorithm_x.html

http://www.cs.mcgill.ca/~aassaf9/python/sudoku.txt

Post reply on HN