gsw
simulate a three species individual-based ecosystem
gsw -help
or
gsw [-width integer] [-height integer] [-steps integer]
[-seed integer] [-plants integer] [-herbs integer]
[-carns integer] [-pmin integer] [-pmax integer]
[-Ep integer] [-Eh integer] [-Ec integer] [-Ch
integer] [-Cc integer] [-Pt integer] [-samp inte-
ger] [-stats] [-pfreq integer] [-noext] [-inv]
[-mag integer] [-term string]
Simulates an individual-based three-species predator-prey ecosystem according to the specified parameters. The three species consist of plants, herbivores, and carnivores (grass, sheep, and wolves; hence the name, gsw). Updates are done synchronously, and each species has several parameters which can control their life cycles, from the ability to give birth, to the likelihood of starvation. Population statistics of the three species can be calculated over a subset of the entire grid.
The time evolution of an individual-based three species predator-prey ecosystem is simulated according to the specified parameters. The three species consist of plants, herbivores, and carnivores (grass, sheep, and wolves; hence the name GSW). Updates are done synchronously, and each species has several parameters which can control the life cycle, from the ability to give birth, to the likelihood of starvation. Population statistics of the three species can be calculated over a subset of the entire grid.
Miscellany
An interesting change to this code would involve making the the updates asynchronous, which would avoid some subtle deadlock conditions that can occur in how the critters move. Moreover, the motion of the overall system would probably be more "lifelike".
Bugs
No sanity checks are performed to make sure that any of the options make sense.
Options
-width | Width of the plot in pixels. | 100 |
-height | Height of the plot in pixels. | 100 |
-steps | Number of simulated steps. | 1000000 |
-seed | Random seed for initial state. | 0 |
-plants | Initial number of plants. | 5000 |
-herbs | Initial number of herbivores. | 500 |
-carns | Initial number of carnivores. | 50 |
-pmin | Minimum plants in vicinity to make new plant. | 3 |
-pmax | Maximum allowed plants in vicinity to make new plant. | 8 |
-Ep | Energy of plant. | 15 |
-Eh | Energy of herbivore. | 50 |
-Ec | Energy of carnivore. | 200 |
-Ch | Step energy cost for herbivores. | 5 |
-Cc | Step energy cost for carnivores. | 5 |
-Pt | Number of steps to grow plant. | 0 |
-samp | Size of subsample statistaics. | -1 |
-stats | Show statistics? | True |
-pfreq | Plot frequency. | 1 |
-noext | Prevent extinction? | True |
-inv | Invert colors? | False |
-mag | Magnification factor. | 1 |
-term | How to plot points. | None |