Programming Assignment 1b - Solitaire, Part 2

Object-Oriented Programming with Java, Spring 2009


Due Date

This assignment is due by 6:00 p.m. on Tuesday, 24 March.

See the assignment turn-in page (last modified on 14 February 2008) for instructions on turning in your assignment.

The Problem

Design and implement a terminal-based program that plays a solitaire game. In addition to documenting your implementation via javadoc in the usual way, the you should also document your design in the javadoc too via the overview and package-local files. Your implementation should contain only one main().

Assignment 1b requires working in pairs. Each person in a pair implements the other person’s game. The only requirement for pairs is that one person in the pair should have taken CS 305 last semester and the other person in the pair should have taken CS 306.

Example Solitaire Game

You can find an example solitaire game implementing Eight Off at /export/home/class/cs-310/a1b.front/eight-off:

$ /export/home/class/cs-310/a1b.front/eight-off/eight-off
fo0:      fo1:      fo2:      fo3:    
fr0:  9s  fr1:  jc  fr2:  3c  fr3:  kc  fr4:      fr5:      fr6:      fr7:    
ta0:  4c  2c  qs  9d  2d  9h
ta1:  8s  8h  5h  qh  7s  3h
ta2:  3s  ac  4d  jd  6d  8d
ta3:  ah  2h  js  5s  7h  7d
ta4:  6c  4s  5c  as  7c  jh
ta5:  6s  8c  ks  9c  4h  kh
ta6:  qc 10s  ad  qd 10d  kd
ta7:  2s 10c  6h  5d  3d 10h
? ^D

$

Game APIs

The solitaire program is designed and implemented using the features provided by the game’s player API; most likely by creating class instances and calling methods. The game’s player API is available as a jar file in the class directory /export/home/class/cs-310/a1b.back under the appropriately-named directory. For example, the player API for Eight Off can be found in

/export/home/class/cs-310/a1b.back/eight-off/eight-offAPI.jar

The easiest way to use the jar file is add it to your classpath variable:

$ CLASSPATH=/export/home/class/cs-310/a1b.back/eight-off/eight-offAPI.jar:$CLASSPATH

The compiler and the JVM will then search the jar file as they look for information on the various packages and features used in the player program.

If you decide to copy the jar file, remember that jar file in the assignment directory may be updated during the assignment, in which case the copy would be out of date. Using out-of-date code can lead to obscure and confusing errors. If you copy the jar file, you should also figure out how to track changes to the assignment-directory jar file and keep your copy up to date. Perhaps the easiest way to track changes is to make a symbolic link to the jar file, or use an entry in your makefile.

Note: Some of the assignments didn’t compile to completion, which means the associated jar file won’t contain the full set of classes. If that’s the case for the game you’re designing, you should contact the game API’s implementer to discuss the matter further.

Documentation

The Javadoc for the game’s player API can be found in the class directory /export/home/class/cs-310/1b.back under doc in the appropriately-named directory. For example, the player API for Eight Off can be found in

/export/home/class/cs-310/a1b.back/eight-off/doc
Point your browser at doc/index.html to start browsing. The file doc/doc.ps contains a printed version of the documentation.

Note: Some of the assignments didn’t generate complete documentation, or any documentation at all. If that’s the case for the game you’re designing, you should contact the game API’s implementer and work out a solution.

Turn-In

There are two possible turn-ins for this assignment: an implementation for assignment 2 and an optional re-implementation for assignment 1.

For Assignment 2: the game implementation should comprise one or more package directories, one of which should have the name of the game implemented followed by UI; for example eightoffUI. As long as the package name ends in UI, case of the rest of the name doesn't matter; for example, EightOffUI is fine too. There should only be one package directory ending in UI.

Use send-files to turn-in the directories under the assignment number 1b.front:

$ /export/home/class/cs-310/bin/send-files -a1b.front -s
package directories sent: eightoffUI

$

If you turn-in your assignment (as opposed to test it) and it compiles successfully, the turn-in code creates a jar file containing your game implementation and a script you can call to run the game. The files are created in the directory

/export/home/class/cs-310/a1b.front/<game>

where <game> is the name of the game implemented. For example:

$ ls /export/home/class/cs-310/a1b.front/eight-off
eight-off  eight-offUI.jar

$

For Assignment 1: If, while dealing with questions from a game designer, you discover that your implementation or documentation can be improved, you may make those changes and turn your implementation in again. Make sure you turn-in your new API implementation to assignment 1b.back, for example

$ send-files -a1b.back -s playerAPI ...

$

If you turn-in the game-API implementation, and it compiles successfully, it will replace the game-API files available in the 1b.back class directory. If the turn-in fails, or if game-API implementation is just being tested, the game-API files available in the class directory are left untouched.

Some Advice

It’s a good idea to keep a recorded trail when working with other people who are important to your project. In addition to providing a handy indicator of the amount of progress that’s occurred, it serves as a convenient place to note previous details and keep track of expected details as well as when they’re expected.


This page last modified on 11 March 2009.