Marine Biology Simulation
Environment. Note that to put things other than
Fishin the MBS Simulation you will also need to change the
Simulationcode, which currently casts all the
Fishobjects before calling the
actmethod. One possibility is to create an
Activeinterface (containing only an
Active, and create your boats or islands or whatever and have them implement
Activealso (possibly with
actmethods that do nothing). The new altmbsgui.jar graphical user interface can handle both display classes and images for
Locatableobjects other than
LocatableImageDisplay). If you add your new classes, such as
Island, to the array of classes passed to
MBSGUI.java, then you can also add/edit boats and islands in the Create Environment part of the graphical user interface. You can find examples of the
Simulationclasses, and new
ifstatements and using the
Randomclass, with a follow-up exercise using an array of integers (this project uses a
BoundedEnvobject for plotting the histogram, although students don't have to be aware of that)
BoundedGridobject (very similar to a
BoundedEnv), plotting pictures by placing colored blocks in the grid; graphics is all behind the scenes
Fishclass. In this project students enhance the way minnows move in their environment, going from simple forward movement to the random movement exhibited by fish in the MBS
Fishclass. It not only allows students to become familiar with a simplified version of the
Fishclass, but also with the
Environment. Students should be familiar with constructing objects, invoking methods, basic flow control constructs, implementing classes, and the
sizemethods of the
ArrayListclass before attempting this project. You may also want to have them read about the
Environmentinterface at the beginning of Chapter 2 and do the first two Exercise Sets in that chapter before completing the Minnow Project.
Randomclass. A follow-up exercise introduces an array of integers. This project uses a
BoundedEnvobject behind the scenes for plotting the histogram.
BoundedEnvdata structure by placing colored block objects in the environment. A row-major traversal method is provided; students implement a column-major traversal, draw diagonals and a border around the perimeter, and so forth. The program "automagically" places a button on the graphical user interface for each method students implement. Students receive visual feedback about the correctness of their algorithms without having to write any graphics code.
Fishclass until it behaves like the actual MBS
Fishclass. Students become familiar with the
Compiling and Executing the MBS Program
ExecutionInformationfolder in the standard distribution has information about running the case study with several versions of CodeWarrior (Macs, PCs, UNIX), from TextPad (PCs), or from the command line under DOS, Windows, Linux, or UNIX (including OS X).
- Gary Litvin and Dave Wittry have provided information on running the MBS (and other programs) under JCreator (PCs).
- The BlueJ site has information on running the MBS under BlueJ. The best thing to do is to download the specialized
BlueJ_Codefolder, which creates separate projects for the two demos, and the versions with and without breeding and dying. (You do not need to delete the standard
Codefolder, just leave the two of them side-by-side.) If you are using a recent version of the JDK from Sun, make sure you have BlueJ version 1.3 (still beta as of late July 2003). BlueJ works under Mac OS X, Windows, Linux, and UNIX.
- Cay Horstmann has provided instructions on running the MBS under Eclipse. Eclipse works under Mac OS X, Windows, Linux, and UNIX.
- Scot Drysdale has provided a version of the MBS case study that does not use Swing graphics. This version can be used under Mac OS 9.
Black Box Source Code
- Source Code for MBS Black Box Classes (the classes in
mbsbb.jar) (You do not need to have or to look at the source code for these classes in order to compile or run the MBS program. The source code is provided here merely for those who are interested in looking under the covers.)
- Source Code for the MBS Graphical User Interface (the classes in
mbsgui.jar) (You do not need to have or to look at the source code for these classes in order to compile or run the MBS program. The source code is provided here merely for those who are interested in looking under the covers.)
*AP and Advanced Placement are registered trademarks of the
College Entrance Examination Board, which has not endorsed this website.
Last modified on 3/11/05 by Alyce Brady.