

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Due Date: Part A: In class Tuesday, September 27 Part B: 6PM Friday, September 30
For this problem, you will apply search to solve Su Doku puzzles.
In this puzzle, you start with an initial partially filled in n Ă n game board. A simple 4 Ă 4 example is given below:
2 1
1 2 4
1 4
3 2
2 1
1 2 4
1 4
3 2
At each step in the game, you can fill in the empty positions with a number from 1 to n. A solution to the puzzle is a fully filled in game board in which each number from 1 to n appears exactly once in each row, column and block. The blocks for a 4 Ă 4 board and a 9 Ă 9 board are shown in bold as below:
A solution to the simple 4 Ă 4 example is given below:
4 3 2 1
1 2 3 4
2 1 4 3
3 4 1 2
4 3 2 1
1 2 3 4
2 1 4 3
3 4 1 2
The difficulty of these puzzles varies greatly depending on the initial board. In some cases, a relatively straight-forward depth first search may work satisfactorily. In other cases, backtracking will be required.
Su Doku can be solved in a number of ways â some options include using uninformed search, heuristic search, local search and constraint satisafaction.
The first part of your assignment, Part A, involves writing pseudo-code for a basic backtracking search algorithm to solve this constraint satisfaction problem for a 4x4 board. Your solution
Programming Assignment 1: CMSC 421, Introduction to Artificial Intelligence: Fall 2005 2
should be about a page long, and should include details about how you will encode and maintain the current assignment as you search and possibly backtrack. You should do this part of the assignment as soon as possible, before you start coding!
The second part, Part B, of your assignment involves writing a C/C++ program to solve this puzzle. We have provided a simple shell for a program which reads in and writes out a Su Doku game board. Your job is to fill in the innards. You may use whatever search algorithm you like, but beware that naive search algorithms may not be able to solve the harder puzzles.
Code and infrastructure for the course is available from /afs/csic.umd.edu/class/cmsc421/0101/common For this assignment, a simple shell of a C program which reads in and outputs a board is pro- vided. Copy the source code from /afs/csic.umd.edu/class/cmsc421/0101/common/pa1/src and use the provided Makefile with make to compile the program.
Sample input and output files are available in /afs/csic.umd.edu/class/cmsc421/0101/common/pa1/input /afs/csic.umd.edu/class/cmsc421/0101/common/pa1/output. Your code will be tested on other inputs, so it is probably a good idea to try some others. You should check for incorrect input.
To receive full credit, you must 1) Turn in Part A your psuedo-code writeup in class on Tuesday, September 26. 2) You must turn in your program as explained in below 3) Submit a 1 page writeup with your program, describing the search approach you used, any other approaches you tried, and successes or failures you had along the way. 2) and 3) comprise Part B and are both due at 6PM on Friday, September 30.
Please remember that your code must work on the class linuxlab system. Please double-check this before turning in your submission.
To submit electronically, execute the following command: /afs/csic.umd.edu/submit/fall2005/cmsc421/bin/submit 1 project1.tar project1.tar is a tar file explained below. project1.tar should be in your current directory.
Note that you will see a message saying that your submission is successful after submitting your tar file. In case of multiple submissions for the same assignment, only the last submission will be saved. The previous ones are overwritten. (Note: use electronic submission only for programming assignments. Homework assignments should be submitted in class or physical copies should be given to the TA or Professor.)