![]() |
School of Engineering and Applied
Science
Department of Computer Science CSci 133 -- Algorithms and Data Structures I http://www.seas.gwu.edu/~csci133/spring03 Prof. Michael B. Feldman mfeldman@gwu.edu |
Project #2
Due Date: beginning of class, Monday, Feb. 10, 2003
This project extends Project 1. It depends on the readings so far, and also on the handouts Incremental ADT Development with Stubs and Passive and Active Iteration in Collection Classes, which is online and linked from the course page.
In Project 1, a Knight's Tour is played with data received interactively from a human user.
In this project, you will extend Project 1 so that once a game begins,
the program will "remember" all valid moves in the
game, and, once the game ends, allow the user to select a "replay"
option that will re-run the latest game. Each actual
move will be displayed in sequence on the board; after each move the
program will wait for the user to press RETURN
before continuing.
Before you start, copy your Project 1 file from your csci53 directory to your csci133 directory, so you can now keep the two courses separated. After you've copied the files, delete the files from csci53 -- especially the .class file, so as not to confuse the compiler or the Java virtual machine!
The move sequence is "remembered" in a collection called a sequence; each new move will be added to the end of the sequence, and the replay will be done by means of an active traversal of the sequence. A few of the methods are coded for you; the rest are stubbed out. Again, you will complete the class and test it with a test program.
detect the move q0 as a "quit" sentinel to end the current game; when the game ends, ask the user whether (s)he wants to replay the current game play a whole new game, or terminate the program.
Grading for the overall project will be the sum of the grades for the three parts.