https://dev.azure.com/thewisetorsk/BioSim
Simulates an island and some basic animals in it. Animals can interact with each other and the enviroment they occupy. This impacts the fitness of the animals.
Annual cycle:
- Food Grows in each cell
- Herbivores feed on grown food in cell
- Carnivores hunt and feed on herbiovres
- Dead herbivores are removed from enviroment
- Animals mate and give birth to offspring
- Animals migrate to neighboring cells
- Animals grow older
- Animals have a "chance" to die
- Dead animals are removed from enviroment
Animal generation uses MathNet.Numerics (NuGet)
Data post processing and visualization uses ffmpeg & python 3 with numpy and matplotlib
FFmpeg is available through Chocolatey or directly from ffmpeg.org
Automatic installation of all depenencies may be available through install script in the future.
Main simulation runs as a console app, with possibilities to control and alter parameters through a MVC web interface
Simulation object can generate output graphs as png through python. Data is saved as csv files available in the Results folder
Current output csv files:
- simResult.csv - Global overview of island population and average "life" parameters.
- HerbivorePopulation.csv - Cell by cell overview of Herbivore population by year.
- CarnivorePopulation.csv - Cell by cell overview of Carnivore population by year.
Main simulation class can be instanced using this constructor
Sim(int yearsToSimulate, string template, bool noMigration);Parameters:
- yearsToSimulate ->
integer
value for the maximum amount of years the simulation is allowed to run.- template ->
string
representing the layout of the island to be simulated using "newline" char for linebreak. ex:"DDD\nSSS\nJJJ"
is a three by three island with three "Desert" cells, three "Savannah" cells, and three "Jungle" cells.
Cell types:
Ocean and Mountain cells are impassable and uninhabitable to animals
"S"
- Savannah"J"
- Jungle"D"
- Desert"M"
- Mountain"O"
- Ocean- noMigration ->
bool
value deciding wether animals are allowed to move between cellsSimulation can be started by invoking the method
Sim.Simulate();
The simulation will run until one of two arguments is met:
- All animals are dead
- Current simulated year == yearsToSimulate
Main Animal class
Main Enviroment class
The parameter class and subclasses decide the behaviour of the animals based on animal class (herbivoreParams/carnivoreParams) and the available food and re-growth rate of food in the island cells.