Overview Design and implement an "agent" that solves a 9x9 Sudoku puzzle.
A given puzzle starts with a few of the cells of the grid filled
in with numbers. These cannot change. To solve the puzzle
you must fill in all the blank cells with numerals 1-9 such that each
row and column has one and only one of each of the numerals 1-9.
In addition, each main 3x3 sub-grid must also have one and only
one of each of the numbers.
Your system should take as input a text file consisting of eleven rows
of characters -- nine data rows and two filler rows. Each
data row is a space-delimitted sequence of numerals or underscores with
pipe characters (vertical bar) separating 3x3 sub-grids. The two
filler rows form horizontal separation between sub-grids.
Your agent should output a completed puzzle where all underscores have
with the appropriate numeral (while abiding by the constraints of the
puzzle rules). Your output must maintain the visual spacing
(filler rows and pipe chars).
Here is an example input
with the corresponding (correct) output.
I want you to implement an informed, or heuristic, search method for this
project. You are free to use any of the heuristic methods that we
have discussed in class.
If you want to use another search method that we have not yet
will not be covering, be sure to
consult with me first. Note, I want you to implement your search
routine. Please don't download an implementation. This is
an easy program to write; we went over the schema for all the search
methods on a single slide in class. I am expecting that you would
spend more time creating and implementing your heurstic (i.e., thinking about what features
of the problem will be useful in distinguishing between good and bad
partial-solutions) than you will on the search routine itself.
Thinking about this in terms of state-space search, the initial state is specified by the
input puzzle, you transform one
state to another by writing a number in an unmarked cell or by
changing the number of a cell that you previously wrote (be careful not
to change any cells that are specified by the input), and the goal state is a 9x9 array of
numbers that satisfy the constraints of the solution.
In order to measure your search effectiveness, you should instrument your code with several
metrics. These must include (but are not limited to) (a) total
number of positions placed on the closed list, (b) total number of
positions placed on the open list, (c) maximum size of the open list
during the course of solving the puzzle, and (d) final solution path
length. (Note, the solution path for these puzzles will always be
the number of underscores that need to be replaced with numbers, but
your code should be written such that if applied in another context it
would report the appropriate path length.)
The goals of this assignment are:
gain experience implementing a search method
think creatively about heuristics that can
effectively guide the search in the Sudoku context
establish a comparison for a later project that will
use a logic-based solution method
have fun and impress your friends and neighbors with
the speed at which you can solve a Sudoku puzzle
Submission and grading
Submit your completed search agents to Eureka in the usual way (zip or
tar file). Include a readme file that explains how to run your
agent, describes your heuristic and identifies it as admissible or not,
and any other special considerations or features that I will need to
know in order to test and grade your project. I will grade this
project based on (a) output solution correctness, (b) coding style, and
(c) heuristic creativity.