Spring '06

CSEE | 201 | 201 S'06 | lectures | news | help

CMSC 201
Programming Project Five

Pirates of the Chesapeake

Out: Monday 05/01/06
Due Before Midnight, Sunday 05/14/06

The design document for this project, design5.txt
is due: Before Midnight, Sunday 05/07/05

The Objective

The objective of this assignment is to give you experience working with linked lists. You'll be using command-line arguments, doing file handling, dynamic memory allocation, passing by reference, and using random numbers. You will also continue to practice using good program design and implementation techniques.

The Background

'Twas a clash of two captains on the high seas of the Chesapeake. Each captain controls a number of ships, each ship carrying one type of cargo. The two fleets, or sets of ships, and all of the sailors on board battle, but 'tis the captain with more sailors that wins.

As a spectator going out for your daily row in the Chesapeake Bay, your job is to represent these captain's fleets in a program as two linked lists. You'll show the transfer of ships between fleets before and after a battle, and even print a portrait of the captain's ships you saw from your little rowboat as ascii art.

The Task

Design and code a project that uses command-line arguments to build two linked lists: one for each fleet in the bay. Based on the total number of sailors in the battle, generate a random number of ships the losing captain must forfeit, and append those ships to the winning Captain's fleet. Print the contents of both fleets before and after the battle, as well as an ascii-art depiction of the each fleet's Captain's ship, containing the captain's name, number of sailors on board, and where the captain is from.

Sample Run

Using the files pirate1.dat and pirate2.dat, this output was generated.

Although your output need not be identical to the above, all information (including the greeting) must be present.

Input Guarantees

The input files will always have:
  1. A captain's name of 14 or less characters
  2. The captain's home of 10 or less characters
  3. A series of boats that has the cargo (<= 49 charcters), weight (in tons), and number of sailors.
  4. One blank line between fleets, designating another captain's information.

Further Specifications

Submitting the Program

Here is a sample submission command. Since you may have different file names you'll have to adjust it to fit your needs. As always, be sure to submit all of the files necessary for your project to compile.
Note that the project name starts with uppercase 'P'.

submit cs201 Proj5 proj5.c pirate.c pirate.h

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show the file that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj5

CSEE | 201 | 201 S'06 | lectures | news | help

28-April-2006 NCP