WHAT IS IT?
-----------
-This model illustrates the movement of trout in a river. The 
river flows from right to left (i.e. 'upstream' is at the
right of the screen, and 'downstream' is at the left of the
screen). Rocks which jut above the water's surface are colored
brown. Deeper water is dark blue, and shallower water is light
blue. Water speed can also be observed by turning on the WATER-VIEW
switch in the interface window, which toggles the display between 
water speed and water depth. When observing the water-speed, faster
moving water is a lighter blue, while slower moving water is shaded
darker.

-Three sizes of trout inhabit our model riverbed. (Yellow fish are
the largest, red fish are of moderate size, and green fish are the
smallest.) All of these trout will seek out the ideal spots in which
to live, using a particular search routine. There are three pre-
defined search routines, to give you an idea of how trout will
react under a given search strategy. The first is to seek out the
deepest pool, the second to find the calmest pool, and the third
a combination of the two. In addition, size is a factor- larger
fish have a natural advantage because they can scare smaller fish
away from choice areas. Fish try to be the sole occupant of their
patch.
   

HOW TO USE IT
-------------
-Select the number of fish with the NUMBER slider, and press the
SETUP button. (You can press the SETUP button again and again 
until you are satisfied with the look of the riverbed.)

-Press the GO button to begin the model. If you find it is moving
too fast for you, set the SLOWDOWN? switch to 1.

-To view water-level elevation, set the WATER-VIEW switch to 0.
To view the speed of the water, set WATER-VIEW to 1.

-There are four monitors which report some information about
the riverbed. FASTEST and SLOWEST report the highest and lowest
water-speed of all the patches, and HIGHEST and LOWEST report
the maximum and minimum values of riverbed elevation.

-The first couple of times you run the model, pick out one fish, and
try to follow it as it moves around. In a model where the number of
fish is high, it can be confusing to try and watch the behavior of
the system as a whole. If your fish momentarily disappears, don't
worry- as fish compete for certain choice spots, sometimes two (or
more) fish try to move into the same patch. Another fish is probably
just sitting on top of your fish.


THINGS TO NOTICE
----------------
-Watch the activity within certain pools (dark blue patches when
viewing water-depth (WATER-VIEW set to 0). Where do the trout
settle? Does there seem to be a general guideline as to where the
water is deepest?

-Watch the interaction between different sized-trout. See if you
can find two large (yellow) fish competing for the same spot. See if
you can find a fish who has left a busy pool, and is travelling
far to find another good spot.

-With WATER-VIEW set to 1, watch how the fish settle. Toggle the
slider back and forth- which do the fish seem to prefer, deep but
fast pools, or shallow but calm pools? What do you notice about the
water-speed of the river as a whole? Where is it calmest?

-How do you think the trout are searching for deep and calm areas?
Try running the model with just one fish, or a very small amount.
The details of the search mechanism are explained below under 
'Extending the Model', and you should look at the procedures window
to best understand the algorithm.


THINGS TO TRY
-------------
-Increase the size of the graphics window if you can. (Select the
Settings item from the Edit menu, and modify the sliders in the
window that comes up.) Alternatively, shrink the window size. Given
a set number of fish, observe how their behavior changes in a small
or a large world.

-A related experiment is to press the SETUP button until you get
a riverbed with very few brown patches, so that the trout have a lot
of room to move around. Watch how they act. Press SETUP again, until
you have a lot of brown patches. How will the fish interact now, in
a densely-packed river?

-Try changing the NUMBER slider- add a lot of fish to the river.
How is this different from a riverbed where there are very few fish?


EXTENDING THE MODEL
-------------------
-The trout use the 'pick-desired-heading' procedure to pick the
direction in which they wish to move. Currently, 'pick-desired-
heading' calls another procedure, 'find-deepest-and-slowest', one of
the three search procedures included at the bottom of the procedures
window. Each trout, before swimming somewhere, looks around and
decides (according to the rules of the current search technique)
what the best patch next to it is. This model has been written so
that writing your own search procedures are easy. Look at the
three procedures 'find-deepest', 'find-slowest', and 'find-deepest-
and-slowest' and try to figure out how they work. Then see if you
can write your own simple rules for each fish. For starters, try
giving each size of fish (each breed) its own search algorithm.

-This model does not take into account the feeding patterns of 
trout.  Create a new version which includes insect life and the 
feeding patterns of the fish.  Create a new search routine which 
has the trout search for areas which provide the maximum amount 
of food.

-The model doesn't take temperature into account either. Add a
patch variable for water temperature, and incorporate it into a
search routine. Trout enjoy cool sections of rivers, and
temperatures above 78 degrees Fahrenheit will kill them. (Deeper
water is generally cooler... why is this?)

-There are many other directions this model can go, especially in
regards to the biology behind the riverbed ecosystem. For instance,
predation, both from within the system (bigger fish eating smaller
fish) and outside the system (a bear fishing for food); spawning
(which might be a good thing to include if you add predation); or
different species of fish, each perhaps with different kinds of
behavior.


STARLOGO FEATURES
-----------------
-If you are running this model under StarLogoT1.5, note that the
graphics window isn't square, as in previous versions of
StarLogo. StarLogoT1.5 now implements these 'rectangular patch
worlds'. You can set the size and shape of the graphics window by
selecting the Settings item from the Edit menu above.

-For the 'riverbed' model, we wanted the water-speed variable value
to propagate backwards from right to left. Normal StarLogo patch
parallelism prevents us from simply saying: 
	if (xcor = screen-edge-x) [setwater-speed 1000]
	setwater-speed (water-speed-at 1 0 + (random 10))

because each patch, including the patches at the edges, will
simultaneously set their values to that of their neighbor. (Hence
water-speed will be 0 for each patch.) Thus, there is the special
procedure 'setup-currents', which uses the patch variable 'speed-
set-counter'. We have a repeat loop that repeats a number of times
equal to the screen-size, incrementing the speed-set-counter each
time through the loop, and only set water-speed when the patches'
xcor is equal to speed-set-counter.


RELATED MODELS AND LINKS
------------------------
-The 'robots' model is another example of using distributed search
techniques to help learn how to write StarLogo programs. You can
find this model in the 'Systems and Computer Science' folder in the
Sample Projects folder that came with StarLogoT. If you don't have
this model, please download it at:
	http://www.tufts.edu/as/ccl/cm/models/robots

-At the Computer Museum in Boston, MA, the Virtual Fishtank exhibit
opened on June 13, 1998. Designed by Mitch Resnick and the MIT Media
Lab, the Virtual Fishtank allows you to design your own fish, write
rules for its behavior, and see how it interacts in a virtual
environment containing 100 other fish. (Similar, but more in-depth
than, this riverbed model.) For more details, please visit the
Computer Museum's Virtual Fishtank website at:
	http://www.tcm.org/fishtank.html