Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

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

  1. Read the remainder of this document. It contains useful information and examples.
  2. Complete thereadPuzzlemethod.
  3. 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.
  4. 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.
  1. Implement a method to get the digits in a specified column of the puzzle. This step is almost identical to Step 4.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. Implement a method that can complete a puzzle that is missing one digit.
  8. Complete themainmethod using the methods that you have implemented.
  9. 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.
  10. 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.
  11. Implement a method that can complete a puzzle that is missing one digit.
  12. Complete themainmethod using the methods that you have implemented.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

1 What does the promotions mix consist of?

Answered: 1 week ago