Documentation for SHARKS! (and Fish too!)
Version 1.1 (filename SHARKS6D.PAS)
Written using OSS Personal Pascal
This program is a loose simulation of the population interactions
between predators (SHARKS) and their prey (FISH). At the moment, the
creatures are based on very simple cellular (sortuv) automata. I have
kept them relatively simple in order to keep the program running at a
reasonable rate. If, after you have seen the program and feel that the
simulation is too limited, I am open to suggestions on what kind of
parameters should be added to the creatures in order to improve the
quality of the simulation. If necessary, I will use Assembly routines
to speed up the slow parts of the program. Of course, those hackers
among you should download the source code and tweek it yourself.
The environment of this simulation is a toroidal water world
(a very small one). At the moment, I am using an 80x23 grid. This is
in keeping with the size of text cells on a Medium Resolution screen.
At the moment, the left and right edges of the screen are adjoined
as well as the top and bottom. This is what makes the ocean a torus. At
all times, there is an abundance of PLANKTON available in all locations.
Since FISH feed on PLANKTON, they will never starve regardless of their
location. SHARKS must eat FISH, so they will constantly pursue their
prey. If no FISH are around, then the SHARKS will eventually starve,
unless they are Cannibalistic.
A fish is represented by a 'f' (green), while sharks are shown
by 'S'. In color, hungry sharks are orange, while sharks that have just
eaten are red. In monochrome, hungry sharks are thin while sharks that
have eaten are thickened. Empty spots are full of plankton.
WHAT THE USER CONTROLS:
As the user of this program, you have some limited control over
the characteristics of the creatures that are floating around in the water.
For the both the FISH and SHARKS, you can set the following attributes:
1) Initial Population ----- number of fish at start of simulation,
2) Breeding Period -------- number of cycles between the generation
of a new fish or shark. All creatures in this ocean reproduce
by binary fission. (No one said they were Earth beasties).
Breeding age resets after each division. Also, the initial
group of creatures have random ages, so that they will not
breed all at the same time.
In addition to the above, you can set the following specs for the SHARKS:
3) Starvation Period ------ How long the SHARK can survive without
feeding. Time is measured from the last cycle in which the
SHARK ate something.
4) Cannibal Sharks -------- This is a Y/N condition. The default
is for sharks to be NON-cannibalistic. Cannibal SHARKS will only
eat other SHARKS if there are no fish in striking range.
I used TOS style parameter entry rather than a Dialog box in order
to improve the control over input of bad values. All parameters are fully
error checked and will not allow you to input "bad values". Thus, for
numeric input, only digit and the BackSpace key will work. I also had
some problem with screen updates that cause the drop-down menus to become
garbled. So, since I'm tired of this program, I am sticking with what
works with the least effort. Just watch for the next project I'm working
on! Much more fun and interactive. 2 months, keep your eye on DL 1.
Also, each parameter prompt specifies a valid range in parentheses
and a default value in brackets. For example,
How many fish to start with (1-1500) :
is a request for the number of fish to start with. It will accept numbers
from 1 to 1500 with a default of 500. To select the default value, simply
press with nothing on the line.
Well, this is just a sort of a demo right now. If I get any good
suggestions for improvements (or just finish adding the ones that I didn't
get around to) the program will get bigger and better. I've been considering
adding things, but I think I'll leave that to programmers other than myself.
Also, the source code is available (OSS Pascal + Free), so any hackers
out there can tweek this puppy as much as they like.