A blog about programming and more programming.


with one comment

SUDOKU’s are one of the most engrossing pen and paper puzzles i have solved. I love them and so one odd day i thought why not make a program to solve them. I knew that many such programs already existed but i wanted to write my own version. SUDOKU’s are known to be NP complete problems (a type of exact cover problem). What i did to optimize it is that i don’t start the backtracking right away. First i try to solve it logically till the point you are left with no option but to guess among choices. This alone is sufficient to solve easy and some medium level problems. Once logically filling is over i start to fill it recursively using backtracking which is required for hard and fiendish puzzles. This isn’t a very good implementation and may contain bugs. You can have a look at it here . Corrently it takes input from file named inputsudoku.txt but you can comment it out and give input from command line. Put 0 in places where no number is present in the sudoku.



Written by fR0DDY

February 9, 2009 at 5:29 PM

Posted in Programming

Tagged with

One Response

Subscribe to comments with RSS.

  1. good work !


    March 18, 2009 at 9:13 AM

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: