This code simulates predator-prey ecosystem Cellular Automaton, a complex system based on the RWCA model [1,2,3]. It uses GSL for the random number generator and EGGX for graphics.
-
Predators and prey walk around the 2D lattice following the RWCA rules. As they move, predators and prey undergo a realistic, gradual reduction in their energy points, accurately reflecting the energy expenditure in a natural ecosystem.
-
A predator will consume prey at the nearest neighbor sites with a certain probability—where the nearest neighbors refer to N, E, S, and W sites—and eliminate the prey.
-
A predator will probably have a baby predator when it meets another predator in the nearest neighboring sites.
-
A prey will also have a baby prey with some probability when it meets another prey in neighboring sites.
Snapshot of the predator (red) and prey (green) ecosystem.
[1] Cellular automaton model for random walkers
[2] Cellular automaton model for biased diffusive traffic flow