IMGD 4000 (D 09)

Individual Homework Assignment #2

Chess World

Due by Web Turn-In: Midnight, Sunday, March 29

(See general homework instructions for turn-in details.)

For this assignment, imagine that you are working for a casual game company developing applications for cell phones. Another programmer has written an implementation of the rules of chess, i.e., the code in edu.wpi.imgd4000. Your job is to add a 3D graphical touch-screen interface for "hot seat" play, i.e., two players pass the phone back and forth between them.

Finally, note that in future releases, i.e., the next two assignments, you will be adding play against an AI and two-person play over the network. Make your design as modular as possible to facilitate these future extensions.

Design Note: The chess logic code was written "defensively", i.e. with tight access restrictions, to prevent it from being broken too easily. (For a nice exposition of defensive programming in Java see Effective Java.) If you really want to modify this code to make private methods be protected, etc., or to write your new code inside the edu.wpi.imgd4000 package, you can do so (since the edu.wpi.imgd4000 package will be included in the turnin for every homework, for just this reason). However, consider the classic object-oriented design tradeoff of "composition versus inheritance". For example, rather than trying to extend the immutable Piece class (immutable classes are good design elements), you can create a new class which has a field containing the appropriate Piece instance and the corresponding graphical node (the pure composition approach). Or you can mix inheritance and composition by making the new class extend Node. Keeping the chess logic separate from the graphics will help when you write an AI which explores possible moves.

Technical Requirements

Please post any questions to the myWPI discussion board for the course.