Hello everyone!
I have been working on a sudoku generator. My main aim is to create a completed 9x9 grid that follows the rules of sudoku. The grid should display unique numbers every time it is run i.e the numbers have to be randomised.
My logic in tackling the problem is as follows:
1.Create a 9x9 array and fill the first row with 9 unique random numbers.
2.Fill the rest of the spaces with zeroes(0).
3.Produce a random number and test the number to the sudoku rules .Columns, 3x3 grids and rows should have unique numbers from 1-9.
4. Repeat the process untill all zeroes are replaced by a number from 1-9.
The logic has some major flaws that are preventing the program from working perfectly.
Here's a general output screen: http://img693.imageshack.us/img693/3732/sudokuq.png
As you can see that those zeroes cannot be filled as the required number does not satisfy all the three rules.
Any help in improving my logic will be very much appreciated. I have attached a rough program in case you need to see the logic in C++ syntax.
Thanks a lot, in advance!