Sharks and Fishes
Write a parallel program to simulate the Cellular Automata
"Sharks and Fishes" An ocean is modeled as a two-dimensional
array of cells. Each cell can hold one fish or one shark (but
not both).
Fish move according to these rules:
- If there is an empty adjacent cell, the fish moves
to this cell.
- If there is more than one empty adjacent cell, the
fish moves to one cell chosen at random.
- If there are no empty adjacent cells, the fish
stays where it is.
- If the fish moves after reaching its breeding age,
it gives birth to a baby fish, which is left
in the vacating cell.
- Fish die after X generations.
Sharks move according to these rules:
- If one adjacent cell is occupied by a fish, the
shark moves to this cell and eats the fish
- If more than one adjacent cell is occupied by a
fish, the shark chooses one at random, moves to
the cell occupied by the fish and eats the fish.
- If no fish are in adjacent cells, the shark chooses
an unoccupied adjacent cell to move to in a
similar manner to the fish above.
- If the shark moves and has reached its breeding
age, it gives birth to a baby shark, which is
left in the vacating cell.
- If a shark has not eaten for Y generations,
it dies.
Email report, code, and results to Instructor.
Note: The report should discuss speedup, efficiency, and
problems encountered, as well as variety of parameters for
X, Y, and initial state.
Extra Credit: Change the ocean from a two-dimensional
model to a three-dimensional model