School of Engineering and Applied Science
Department of Computer Science
CSci 133 -- Algorithms and Data Structures I
http://www.seas.gwu.edu/~csci133/spring06
Prof. Michael B. Feldman
mfeldman@gwu.edu

Project #2

Due Dates: Phase I (javadoc and test plan): beginning of class, Thursday, Feb. 9, 2006
Phase II (full submission): beginning of class, Tuesday, Feb. 21, 2006

This project extends Project 1 and also serves as an exercise in software restructuring. 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.

The Knight's Tour program you wrote for Project 1 is a single file, with (perhaps) a few local functions and a lot of statement-level code. In this project, you will distribute much of that functionality into three reusable classes, and rewrite your Knight's Tour program to take advantage of the reusable class structure.

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.

Do this project in your csci133 directory; make sure your Project 1 source file is in csci133.

Phase I:

Copy programs133/ChessPosition.java into your csci133 directory. This file is a skeleton for an ADT class each of whose objects is a position, that is, a pair consisting of a file and a rank. The class provides four methods: a constructor, two accessors or "getters" that return the rank and file, and a toString method that returns the position as you might type it in: a3, for example. The bodies of the four methods are stubbed out.

Copy programs133/KnightSequence.java into your csci133 directory. This file is a skeleton for an ADT class each of whose objects is a sequence of chess positions. 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.

In this project phase you will produce javadoc pages and test plans for the two classes.

Phase II:

In this phase you will complete the method bodies in the two classes, and finally, you are ready to integrate everything. Modify your knight's tour program to have the following characteristics:
  • 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.
  • What to submit:

    With this project, the deliverables change from the CSci 53 style, because you are developing two classes and an application, instead of just an application as in Project 1.

    Phase I:
    Phase II:
    Grading:

    Grading will be divided into 5 points for Phase I and 15 points for Phase II.