Question: Sudoku is a logic - based, combinatorial number placement puzzle. The objective is to fill a 9 x 9 grid with digits so that each

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.1
2 Requirements
Write a C program that reads a bunch of sudoku puzzles from standard in-
put and solves them. Each puzzle is given as a line of 81 characters, with .
characters representing unknown digits.
If a solution exists that uses the given digits in the given order, find it and
print it. Specifically, echo the input on one line and print the solution on
a new line.
If not, echo the input and print No Solution on a new line.
If the input does not follow the specified format, print Error on a new
line.
After each test case, output a blank line to standard output. So, each line
of input will produce 3 lines of output: echo of input, output line, and
blank line.
Whether or not the test was a valid sudoku puzzle, your program must
be prepared to handle the next test. Make sure that you do not leave
your program in an invalid state as the result of an error test case. This
is a particularly common issue when dealing with lines that were not of
the expected length. Make sure you reset all relevant bookkeeping before
beginning the next line of input.
1Thank you, Wikipedia.
1
2.1 Input Format
A record is a sequence of characters followed by the newline character:
.
The input will consist of some number of records (lines).
Each valid record will consist of 81 characters, representing the 9 rows of
a sudoku puzzle, each consisting of 9 characters.
The only valid characters in a record are the nine possible digits (1-9) and
..
A valid record does not have the same number appear twice in the same
row, column, or box

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!