Lab 6

Goal: For this lab you will write the definitions of the remaining functions of the class sudoku. Thus you will create a system that does the following:

  1. Read in a partially complete sudoku puzzle from a file
  2. Solves (if possible) the puzzle, filling it in the missing values
  3. Write the solution to another file

Lab 6 Github Classroom Assignment

Complete the program from the textbook in Chapter 6 to solve sudoku puzzles. Your program should take the input from a file. Let the user enter a file name. You can assume that the file is in the same folder as your program. Do not require the user to enter the entries from the keyboard. For output, send it both to the screen and to a file. Ask for the name of the output file from the user as well.
You can assume that the file you read the input from has the right format, i.e. 81 integer values between 0-9 with 0’s indicating blank spaces. Test your program with several sample input files (but it should be able to read from any input file specified). 

Notes:

  1.  The description of the findEmptyGridSlot function given by the textbook (and source code) is misleading. A more accurate description is: This function finds the first empty square, returns these coordinates in its arguments row and col, and returns true. If there is no empty square, then returns false.
  2. The sample code in the text refers to code to allow the user to type in a puzzle. we are not doing that, you should adjust the code to only get the puzzles from a file.

You will need to use recursion for this problem.
You should turn in solutions for:

You can generate more problems for testing here: link

Grading

RequirementsGrading CommentsPointsScore
Good Code Design30
Solves all solvable sudoku puzzles above20
All required functions implemented20
Quality User Interface20
Comments10
Total100


Pair assignments:
Lab5-Pair-01: Lucas Waite, Trang Nguyen
Lab5-Pair-02: Shadia Amado-Aguad, Joey (Jiayin) Liu
Lab5-Pair-03: Sariyah Sintayehu, Peter Dunson
Lab5-Pair-04: Davelle Ampofotwumasi, Leo Xie
Lab5-Pair-05: Luke Galik, Khanh Mai
Lab5-Pair-06: Nora Archer, Yaw Oppongkrampah
Lab5-Pair-07: Moe Belghith, Ella Rigoli
Lab5-Pair-08: Eden Cohen, Cloris (Zongyu) Liu
Lab5-Pair-09: Calvin Deka, Hoan Nguyen
Lab5-Pair-10: Djordje Dragojlovic, Westley (Kelly) Kailus
Lab5-Pair-11: Danny Vasconez
Lab5-Solo-12: Adam Khan
Lab5-Solo-13: Kuba Kopczuk

Scroll to Top