## SUDOKU

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.

-fR0D

good work !

IndianMarch 18, 2009 at 9:13 AM