I am having some trouble with a sudoku solver I wrote. It solves around 80% of the puzzle and then gets stuck on the last few spaces. At the end there's always 5-7 blank spots that cannot be solved (there are no legal options avaliable). What am I doing wrong? I am trying to use a simple brute force method. Any helpful hits would be much appreciated!

If there aren't any legal options left then your code isn't solving the sudoku properly.

If you simply go through the puzzle and write any correct value (for example, test 1-9, and use the first fitting one) in each box then you're not solving the puzzle correctly. You need to make sure that you only have one possible number for each box (by looking at relationships between the larger 3*3 boxes and 9*1 lines, and discovering spaces where only certain numbers can fit)

If you simply go through the puzzle and write any correct value (for example, test 1-9, and use the first fitting one) in each box then you're not solving the puzzle correctly. You need to make sure that you only have one possible number for each box (by looking at relationships between the larger 3*3 boxes and 9*1 lines, and discovering spaces where only certain numbers can fit)

Topic archived. No new replies allowed.