Answered step by step
Verified Expert Solution
Question
1 Approved Answer
( Please read requirements of the program carefully screenshot your output ) Write a Java program that performs the following tasks: Display a friendly greeting
Please read requirements of the program carefully screenshot your output
Write a Java program that performs the following tasks:
Display a friendly greeting to the user
Prompt the user for a filename if the file wasnt provided on the command line
Accept that filename
Attempt to open the file
Read the numbers in the file and populate a x table with them
Note: the char or is used to designate an empty spot
because is a valid entry in the hexoduko puzzle
Display the contents of the file
Solve the puzzle using the algorithm given
Display the solved puzzle, or an appropriate message if no solution is found
The rules of Sudoku:
The integers appear in a x grid. The grid is subdivided into nine x subgrids.
The thee Sudoku constraints are:
Each digit appears in each row, without omissions or duplicates
Each digit appears in each column, without omissions or duplicates
Each digit appears in each x subgrid, without omissions or duplicates
Diagonal Rule Sudoku adds a fourth constraint:
Each digit appears in each of the two long diagonals, without omissions or duplicates.
The isValidPuzzle method need check only these constraints; if they are satisfied, well call it a valid puzzle.
The input file will be integers, spacedelimited. Test your program with a variety of Sudoku puzzles. They are easily found on the net How long does it take your program to solve the Worlds Hardest Sudoku? Or an empty puzzle?
Note that if you get the regular version working, the Super version only differs by a few lines in the isValidPuzzle method. However, be careful how you test it; most regular Sudoku puzzles arent diagonalrule Sudokus and youll need to find specific test cases for them.
You can solve other number puzzles like Numbrix with this technique by dropping in the appropriate validator. The rest of the code is unchanged.
The standard solver is worth full credit; a diagonalrule solver gets you an additional points. For yet another ten points there is the x Hexadoku, with sixteen x regions and entries in hexadecimal and AF and even the base puzzle using and AZ
Note: if you are thinking ahead you can write an entirely generic Sudoku solver that will handle xxxx and x puzzles using and AZ gets you to base The limitations are that you run out of symbols to represent the values if you go beyond base and the algorithm is exponential so the solve times on larger puzzles can become...large.
Throw in a Numbrix solver for yet another points. You can do Magic Squares as well, and pick up even more points.
The input file :
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started