Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

>> REGISTER NOW TO START POSTING

1. ## 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.

2. ## 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'.

3. ## The Following User Says Thank You to copeg For This Useful Post:

JavaPF (December 1st, 2009)