CSc 3610 Programming Assignment #5

Work on this with your assigned partner. Take turns programming and error catching. Turn in one copy, with both names on it.

The first thing in your program should be documentation, just like with homework 1.


  1. Practice pair programming.
  2. Practice implementing a program design in MATLAB.
  3. Practice adding functionality to an existing program.

We have been working in class on the implementation of a puzzle. We have pieces defined, and a board where all of the pieces should fit together, to form a square. We even have an algorithm to follow. Now we just need to complete the job.

Instead of having the computer solve the problem, we will present it as a game to the user. The program will allow the user to select a piece, and add or remove it from the game board. If the puzzle is complete, the program will indicate this and exit. The programs that we developed in class, putpieces.m and pieces.m, are available on qubit. Use these for your solution, but you should feel free to change them as needed. Also available is pieces_session.txt, a saved MATLAB session from the November 7 class.

Maintenance forms a large percentage of the life-span of software. That is, you are just as likely to spend time working on an existing software system as you are writing a new program. First, of course, you must understand what you have to work with, then make changes and additions as appropriate. Keep track of the software as you change it, in case you need to roll-back changes. Professional programmers use software to do this, such as Concurrent Versions System (cvs). (Try "man cvs" at your computer's command prompt for more information.) No, you do not have to use cvs for this homework; I will leave it to your group to keep track of your software versions as you see fit. The grader will not know if you did this or not.

Your program should first define a game board, and initialize it (already done). Then it should define the pieces (partially done; you will need to figure out how you will store them efficiently). Your program should display the current state of the puzzle, get input from the user, and react accordingly (i.e. add, or delete a piece). It also must recognize when the puzzle is complete, and exit.

Your solution must include at least one function that you define.

Since the program has already been designed, and a partial solution is available, your design and comments should clearly define what you add, versus what was already available. So instead of doing a design with variables and operations, you should document what was available, what you deleted, what you changed, and what you added. Finally, test your program thoroughly.

E-mail your MATLAB source code to the TA (the TA's e-mail address is : ). Do not e-mail the design, do not e-mail the script/output. Do not CC the instructor in your e-mail. Your e-mail should clearly state who you are, that you are in this class, and what you are e-mailing. Make sure to CC yourself on the e-mail, and bring a printout of the e-mail with you to class (see item 4 below). This e-mail does not need to show the text of the attachment, but it should indicate that there is a(n) attachment(s) and what its name(s) is(are).

Turn In Electronic copies of your files to the TA.

NEW:Here is a puzzle solution.

Turn In Hard copies of:
  1. your design (behavior, variables, operations, algorithm)
  2. your source code
  3. a copy of your e-mail to the TA
The printouts of the above must be handed in during class. To be considered "on-time", you must turn in all of the above on-time. Make sure that your printouts use a monospaced font.

Due date: November 16, 2006