Hi,

I have to do a project on Sudoku. I am finished generating the complete board. Now my major task is to generate a puzzle out of the complete board with the difficulty level. Can some one give me clue to remove the elements randomly from the board. Later on once the board is partially filled i have to check such that the board has a unique solution and then design the difficulty of the board.

Can some one help me please. I have this project due this week. I am ready to work hard day and night. This project is so important for me in the course. I would appreciate if some gives me hints and help me completing this project..

2
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by whimsical1987

It would have been better if you provided the code to your program. Anyway, assuming your using an array to store the sudoku values, you can use a random generator function to select a random index from the array.

Here is an example of generating a random number between 0 to 80
(as sudoku has 9*9 = 81 squares, array index range will be from 0 to 80). You can clear the array values at the generated indexes which will get your desired output.Hope it helps.

``````import java.util.Random;
/** Generate 10 random integers in the range 0..80. */
public final class RandomInteger {
public static final void main(String... aArgs){
System.out.println("Generating 10 random integers in range 0..80.");
Random randomGenerator = new Random();
for (int idx = 1; idx <= 10; ++idx){
int randomInt = randomGenerator.nextInt(80);
System.out.println("Generated : " + randomInt);
}

System.out.println("Done.");
}
}``````

Thanks. It works like a charm.
Now I have to use trees to keep track of my board to remove the elements from the board simultaneously checking whether the board has a unique solution or not.
Each element I remove I have to keep track my board and also check whether the board has a unique solution or not.
Any links that could help me alot, or some one can give me good hints to crack this project. This project is so important for me. So please help me as early as you can.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.