Sudoku is a logic-based, combinatorial number placement puzzle. The objective is to fill a 9x9 grid with digits so that each column, each row, and each of the nine 3x3 sub-grids that compose the grid (also called “boxes”, “blocks”, “regions”, or “sub-squares”) contains all of the digits from 1 to 9. The puzzle setter provides a partially completed grid, which for a well-posed puzzle has a unique solution.
Write a C program that reads a bunch of sudoku puzzles from standard input and solves them. This program needs to be started from sudoku-starter.c. You will also need to write a makefile that compiles your code. You should use testSudoku.in/testSudoku.out to test your code. Whitespace/other small formatting details matter.
Each puzzle is given as a line of 81 characters, with ‘.’ characters representing unknown digits.
Your program is expected to be able to print out any sudoku puzzle in the grid format. For example:
Attach your program file sudoku.c to the Sudoku assignment in UNM Learn.
This assignment will have milestones to be completed during lab. During the first week of lab, you will need to instantiate readLine and prettyPrint. You may test this with single.in/single.out. The second milestone will look at how much you've accomplished after you finished the first milestone. Full points will be given to students who make progress past the first milestone, for example, students who map out their backtracking algorithm and finish a small function. No points on the second milestone will be awarded to students who have not completed the first milestone or who have not progressed past the first milestone. Each milestone is worth 5 points towards your lab assignments grade.
[-5 points]: | The program does not start with a comment stating the students first and last name and/or the source file is not named correctly. |
[-10 points]: | Program compiles with warnings on moons.cs.unm.edu machine using /usr/bin/gcc with the -Wall -ansi -pedantic options |
[-10 points]: | Program takes more than 5 minutes to complete all tests in testSudoku.in, regardless of correctness of output. |
[20 points]: | Code follows the CS-241 Coding Standard and Makefile compiles code appropriately. |
[60 points]: | 2 points for each passed test record of testSudoku.in using:
./yourprogram < testSudoku.in > youroutputfile
diff youroutputfile testSudoku.out
|
[20 points]: | 1 point for each passed test record of an unknown set. |
[5 bonus points]: | Correctly solve a file of 100 unknown test cases in less than 2 seconds (when run on moons.cs.unm.edu). (Hint: one of the unknowns may be hardPuzzle.in) No extra credit possible if you do not pass all the tests in testSudoku.in (Let’s not waste the graders’ time timing incorrect programs.) You program will be timed using the time command as follows:
time ./yourprogram < inputfile > outputfile
|