Sudoku

• November 30th, 2009, 05:50 PM
mgutierrez19
Sudoku
Can anyone help me on this??
Write the pseudocode of the algorithm that does the following:

* it takes a 9x9 matrix filled with numbers from 0 to 9: 0s stand for a missing sudoku number (a number to be determined), other numbers (from 1 to 9) stand for numbers that are given (corresponding to the numbers that appear on the grid of your book of sudoku when you do it on paper).

* it returns a 9x9 grid filled with numbers from 1 to 9 in such a way that the numbers meet the constraints of sudoku.
• November 30th, 2009, 09:09 PM
copeg
Re: Sudoku
Google turns up a lot of code for sudoku solvers, so I encourage you to look into it. But to start with, you need to write a few methods to solve the puzzle based upon the rules. One method can check for entries based upon row/column/box exclusions which only allow a single number in the cell (eg you have 123450789 - you can obviously fill in 6). Another method can fill in the grid based upon the process of elimination (surrounding rows, columns, and boxes restrict the value of a certain cell - here you can calculate the possible value for each cell and only one possibility allows you to set its value). A third method can be used if neither of the two above methods sets a value, this method seeds the puzzle then lets the other methods proceed - this method should be able to backtrack should the puzzle not be solveable based upon its 'seed'.