I'm trying to figure out how to solve a sudoku puzzle using a backtracking algorithm (any other way would be ok as well).
Any hints? Any code you could share??
So far i've managed to develop a function able to detect when only one number can fit into one slot, applying this function a few times, and filling the square with the only right number i get to a point where i have no more slots available where only just 1 number would fit.
So now, i need to apply a backtracking algorithm, trying to fill out with one of the 2 or more numbers that would fit the gap, if the number is OK, i can go on filling the following ones, if i get to a point where no more "moves" can be done, i must go back and change the previously wrongly guessed number and try with the next available one.
Well, basically thats the backtracking technic.
How can i translate that easy-to-say-code into java (c++ ok too) code ??
I would appreciate if someone could help out.
I can share my code with others, could be helpful, just ask.