Question: Write a program by java which will generate a Sudoku puzzle. The object of this puzzle is to ll in the rest of the grid
Write a program by java which will generate a Sudoku puzzle. The object of this puzzle is to ll in the rest of the grid with numbers such that each row, column and 3 by 3 square contains the digits 1 through 9.
You should use a branch-and-bound algorithm to solve this problem, in two different capacities. First, you should write a branch-and-bound method which when given a sudoku grid returns a boolean value indicating whether or not there is a unique solution. If you solved the previous project, then this should be a small modification to that projects algorithm. Once you have the checker working, you then must write another branch-and-bound method which, along with a random number generator, completely fills in a grid. Once you have a grid, you can start removing values from it and then check to see if you still have a puzzle with a unique solution. If you remove a value and find that there are more than two solutions, then you must put it back and try removing another one.
Input will consist of a single integer r which speci es how many digits should be in the puzzle when it is nished. The maximum value for r is obviously 81 (i.e., a fully lled grid), and we'll use 25 as the lowest allowed value { any lower value entered should be set to 25 (you can actually go lower than 25, but it sometimes takes a while to generate a puzzle for r less than 25).
you should output the solution to your puzzle to the le XXX.ans
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
