I\'m trying to make a Sudoku Solving program for a couple of days but I\'m stuck with the methods. I found this algorithm here but I don\'t really understand it:
TNode
TNode => vector
S
can have number N
added at row I
, column J
if:
(I,J)
is emptyN
in row I
N
in column J
N
in the 3x3 square containing (I,J)
S
to the vector
of states that satisfy these rulesYour current approach mixes the specification of the graph to be searched and the implementation of the search algorithm. You're going to have a lot of difficulty if you mix those two. This problem naturally separates into two distinct pieces -- the algorithm and the graph -- so you can and should exploit that in your implementation. It will make it much simpler.
The other benefit you get if you go with this separation is that you will be able to reuse your graph search algorithm on a huge number of problems - very cool!