Im trying to make a sudoku puzzle generator.. my logic is this- make a 9 by 9 array and a single dimensional 9 by 1 array. iterate through 00 to 88 (row wise) of the 1st array with two variables i and j. avery time i increases (and at the beginning)
store the 1D array with numbers from 1 to 9 in order. now choose a number at random from the 1D array. insert it into the i,j th position of the 2d array, if it doesnt violate the sudoku conditions. otherwise , continue. when i insert the number(if it doesnt violate the conditions) i remove that number from the 1 D array.
THe problem is, this program gets stuck. When i tried it for a smaller 3*3 grid, using only 1, 2 and 3 it works.
Note: this is only the first part, where im trying to generate a fully solved grid
I solved the sudoku problem using backtracking...
If you want to also solve sudoku using backtracking, you should try to solve the Eight queens puzzle first as it is easier. Once you figure out how to solve eight queens puzzle, you should have a good idea as to how to solve your sudoku problem http://www.sendspace.com/file/dshefo
My compiled solution