Question
Problem description: Reads in a Sudoku puzzle from a file using the digits from the file to fill in aPuzzleobject. The file always contains either
Problem description:
- Reads in a Sudoku puzzle from a file using the digits from the file to fill in aPuzzleobject.
- The file always contains either a completed Sudoku puzzle or a Sudoku puzzle where one digit is missing; the missing digit has the value 0 in the file.
2. If the puzzle is missing a digit then the program fills in the missing digit with the correct digit, prints the completed puzzle, and then exits. A puzzle that is missing a digit is always correctly solved except for the missing digit.
3.If the puzzle is not missing a digit then the program tests if the puzzle is a valid solution (i.e., it checks if every row, every column, and every block contains the digits 1 through 9).
- If the puzzle is a valid solution then the program prints the messageThe puzzle is a valid solution, then prints the puzzle, and then exits.
- If the puzzle is not a valid solution then the program prints a message indicating which rows, columns, and blocks contain errors, then prints the puzzle, and then exits.
this is the start code : https://research.cs.queensu.ca/home/burtonma/CISC124/A1/CISC124_A1_project.zip
Strategy for completing the assignment
- Read the remainder of this document. It contains useful information and examples.
- Complete thereadPuzzlemethod.
- Implement a static method to print a puzzle. Test that you are reading in puzzles correctly by printing a puzzle that your program has read.
- Implement a method to get the digits in a specified row of the puzzle. You can return the digits as a list or an array, but using a list is easier than using an array.
- Note:A possible solution for this step is already done for you. See therowmethod.
- Implement a method to get the digits in a specified column of the puzzle. This step is almost identical to Step 4.
- Implement a method to get the digits in a specified block of the puzzle. This step is a bit trickier than Steps 4 and 5.
- Implement a method that tests if a list of nine integers (or an array if you are using arrays) contains the digits 1 through 9.
- Implement a method that tests if all of the rows of the puzzle are valid (use the methods you implemented in Steps 4 and 7). It is very useful if this method returns a list or array of indexes of the rows that are not valid so that you can print out these indexes later on.
- Implement a method that tests if all of the columns of the puzzle are valid (use the methods you implemented in Steps 5 and 7). It is very useful if this method returns a list or array of indexes of the columns that are not valid so that you can print out these indexes later on.
- Implement a method that tests if all of the blocks of the puzzle are valid (use the methods you implemented in Steps 6 and 7). It is very useful if this method returns a list or array of indexes of the blocks that are not valid so that you can print out these indexes later on.
- Implement a method that can complete a puzzle that is missing one digit.
- Complete themainmethod using the methods that you have implemented.
- Implement a method that tests if all of the columns of the puzzle are valid (use the methods you implemented in Steps 5 and 7). It is very useful if this method returns a list or array of indexes of the columns that are not valid so that you can print out these indexes later on.
- Implement a method that tests if all of the blocks of the puzzle are valid (use the methods you implemented in Steps 6 and 7). It is very useful if this method returns a list or array of indexes of the blocks that are not valid so that you can print out these indexes later on.
- Implement a method that can complete a puzzle that is missing one digit.
- Complete themainmethod using the methods that you have implemented.
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