Data Structures Homework 1, Fall 1999

Sept 10, 1999 12:00 PM (ABSOLUTELY NO LATE SUBMISSIONS)

Your assignments will lead up to an efficient program that will solve the puzzle shown here. The pieces can be moved by clicking on a tile adjoining the blank tile. The objective of the game is to piece together this wonderful ;) picture.



In your first homework, you will implement two classes Board and BoardSuccessor. These classes will extend classes BoardAbstract and BoardSuccessorsAbstract respectively. These classes are downloadable from the link below. In addition, you can also download the solution classes Board.class and BoardSuccessors.class from this location. In addition, a tester program Test.java is also available. Download the files BoardAbstract.java, BoardSuccessorsAbstract.java, Board.class, BoardSuccessors.class, and Test.java. Compile these files a required and run Test to see how the program is supposed to work. Once you do this, you can set about writing Board.java and BoardSuccessor.java yourself.

I have also provided a GUI for the programs. You can download Puzzle.class (which contains an applet that uses your classes), hw1.html (that uses this applet), and a directory called images. You will need to create a directory by the same name (images) in the directory you are copying these files into. Then copy all the images in the images directory to your machine. Once you are convinced you have everything working, bring up hw1.html in a browser (or using appletviewer). The applet is written to display your initial configuration. On clicking the board, it will show the successor configurations.

The program when running should look something like this.

Here is where you can get the various classes:

Once again, remember, there is a very strict academic dishonesty policy and all programs will be compared using moss! Happy coding.