CS 132
Computer Science II
Octo-Fish

David B. Levine
Computer Science Department
St. Bonaventure University
Copyright, 2000,2001

Objective

 

            This lab will familiarize you with the Marine Biology Case Study, Part II.  The idea is to study how the different parts of the program interact.

 

General Idea:

            We will make a series of different modifications to the simulation.  In each case, the modifications will prove to be highly localized within the program, thus pointing out the quality of the software design.

 

Instructions:

  1. Build a "pristine" version of Part II of the case study.  Choose a new MBCS project in CodeWarrior and choose the Part II option.  Run the simulation for a few steps.


  2. First,  we will examine the data file.  Double-click on fish.dat in the project window to open up the data file.  Move the fish around a bit until you understand the format of the file.


  3. It would be more convenient if the simulation asked us the name of the file before it began.  Modify fishsim.cpp to make this change.  (There is no difference between opening these data files and any that you used in CS131.)  Create a new data file (fishenv.dat) that contains the exact fish data from the comment in environ.h (also found on page 24 of the case study document).  Also create a new file (canal.dat) that contains the fish data for the "canal" shown on page 25.  Use these two data files to test your changes.


  4. Now modify your program so that the fish move in eight directions.  This will involve making the changes discussed in class, but recall that there is at least one other change that you need to make.  If you can't figure it out, try to run the program with only the changes from class and see what happens.  Test your program on all of your various data files.  Be sure that it works in the canal!


  5. Some people find the display difficult to read due to the positioning of the blanks.  Change the program so that the display draws a tilde (~) for any spot that has open water.


  6. Add the code necessary to permit fish to "rest".


  7. Complete the following worksheet.


Hand in:

        Hand in a cover page, a completed version of the worksheet from Step 7, and any listings of any files that you changed.  Be sure that all appropriate documentation has been updated.

 

Assignment Type (see Academic Practices and Policies Document):

            Group assignment, limited collaboration.