bargainlkp.blogg.se

Rabbit population simulation game
Rabbit population simulation game












rabbit population simulation game rabbit population simulation game

even adding a new species is fairly simple.įrom matplotlib import animation as animationįrom progressbar import progressbar as prbar # (use pip/conda install progressbar2, or rewrite line 116.) Rabbit and a (newborn/not) fox occupies the same point, the fox eatsĪnd, of course, there's a lot of possibility to play around: change parameters like energy or spawning probability, initial values, rules of interaction (recharge energy when feeding?) or spawning (spawn only if two of the same species on the same place? after feeding). in each step, there's a small chance for each point that a newborn rabbit or fox spawns there, with fresh energy.If an animal runs out of energy, it dies. Each animal starts with a given amount of energy, and each timestep they lose 1 energy.If a rabbit and a fox steps on the same spot, the fox eats the rabbit, so the rabbit dies.In each step, each of them moves 1 step to a neighbour grid (no diagonal movements).Initially an exact number of them is spawned on random distinct locations.There are two species competing on a rectangular grid: rabbits and foxes.

rabbit population simulation game

I'd like to hear your opinion about this: how could the concept and the code structure be improved, and how good is my implementation? Rules in the model: I made a random-walk predator-prey simulation that focuses on individual animals instead of the (maybe) more common array-based approach.














Rabbit population simulation game