CS 6510 HW 1
Create a Sudoku solver that works on arbitrary board sizes.
The input to your program (supplied on standard input) is two positive integers, m and n, which are given on a single line in decimal notation separated by a space character. Next in the input will be m times n lines, each of which supplies n times m space-separated board elements. A board element is either an integer between 1 and m times n, inclusive, or it is an underscore character, _.
The numbers m and n define the shape of the board as having small regions that are m cells wide and n cells tall. The overall board has n such regions across and m regions down. The remaining input lines define the board content, scanning left to right and then top to bottom, where _ indicates a position that has not been determined. Your solver's job is to replace every _ with a number, and then print the resulting board back out – in the same form as the input, but with no underscores.
For example, the input
2 3
1 2 _ 4 5 6
3 4 _ 6 1 2
5 6 _ 2 3 4
2 3 4 5 _ 1
4 5 6 1 _ 3
6 1 2 3 _ 5
represents a board
Last update: Saturday, January 12th, 2008mflatt@cs.utah.edu |