On Fri, 19 Jan 2007 00:44:39 -0500 Thomas Hruska <[EMAIL PROTECTED]> wrote:
> ed wrote: > > On Sat, 06 Jan 2007 18:56:58 -0000 > > "vignesh_ahobila" <[EMAIL PROTECTED]> wrote: > > > >> Hey did anyone have the code for sudoku. > >> > >> [mod - Have you ever heard of Google? > >> http://www.google.co.uk/search?q=sudoku+C - PJH] > > > > > > i dont know much about sudoku puzzles, but i imagine a 2d array of > > int's would be what you're after and some brute force to calculate > > the results. > > You've clearly never written a puzzle solver before. NEVER, EVER > brute force anything unless you are unable to figure out initial > patterns. never ever, say never ever. correct though, i've never been interested in solving puzzles like this and less interested in sudoku. > In the case of Sudoku, you can deduce many numbers before having to > guess. And a lot of puzzles are complete enough to never have to > guess. When you guess in a solver, you squirrel away a copy of the > board on a stack before the guess without the option of guessing it > again should you have to backtrack. Then you work with the new board > and deduce any numbers. Repeat until you have success or failure. > If you reach a failure scenario, back out until you can continue > forward again. Upon success, print the solution and exit. Done > right, it can solve any 3x3 puzzle instantly. interesting, i'd never have thought about that. -- Regards, Ed :: http://www.linuxwarez.co.uk just another unix hacker Chuck Norris punched out Einstein for stealing his ideas.
