Find multiple sudoko solutions

Hi everyone,

I have successfully written a program that can find one sudoku solution using recursive backtracking. Now, I have to find all sudoku solutions. I know that I first need to find all possible valid numbers for each empty cells. However, I don't know how to store them. Should I build a 3D array? If not, how?

Thank you.
which one of all the solutions did your program find?
Ideas that I like, but probably aren't the best:

> 2D array of strings like "125" for 1,2, and 5 being possible numbers.

> 2D array of integers like 136 for 1, 3, and 6 being possible numbers. You would have to write a function to find the nth decimal digit of a number and check that the number contains that many digits. You would have to make sure that 0 as a possible value for that square wasn't the first value (i.e. storing an integer of 0178).

> 2D array of integers from 0 to 512 to be interpreted as binary numbers where the nth binary digit represents that n is a possibility. For instance, the number 2210 in decimal (101102 in binary) would mean that 1,2, and 4 are possibilities for that square. You would have to write an function to find what the nth binary digit of a number is.


All of these are probably overly complicated and useless, and you probably don't want to use them in your program. :D

Numeri
My $0.02: a well defined sudoku problem has a unique solution
Topic archived. No new replies allowed.