4 ms·
To show my kids a bit about programming we made a simple rabbits-and-foxes simulation. Little dots moving around a rectangle drawn on the screen. The red ones w
by jbattle 7y ago
To show my kids a bit about programming we made a simple rabbits-and-foxes simulation. Little dots moving around a rectangle drawn on the screen. The red ones were rabbits, would move mostly randomly, and would periodically make a baby rabbit. The blue ones were foxes and would chase nearby rabbits. When they caught one they'd eat it and make a baby fox.
Fun to watch but we found no matter how we set the initial counts of rabbits and foxes, inevitably there'd be a population spike of rabbits, which would cause a lot of foxes to be born, which would eat enough rabbits (sometimes ALL of them) that the rest of the foxes would starve and go extinct.
We tweaked all kinds of parameters about how they move and how they reproduce and nothing kept the system from oscillating into a broken state.
Eventually we added a "rabbit preserve" - an area rabbits could pass freely through but foxes couldn't enter. Just like that - the system was stable(ish). There would still be population peaks and valleys but as long as the preserve was reasonably large the rabbit population might crater but wouldn't crash.
Its a nice little project, easy to code and fun to watch
- losteric 7y agoFox predators, aging, and/or direct competition (fighting) could be an interesting lesson in dampening feedback to reduce those oscillations. Simulating grass carrying capacity, other herbivore competition, different predator niches, etc all further increase stability / resilience to change.
- microcolonel 7y agoAdd earthworms. ;- )
- alanh 7y agoIs this a joke or reference, perhaps?
- jt2190 7y agoMy understanding is that lion prides are territorial, but the herds they prey on are not. The prides with prey in their territory eat; those without starve. This sounds similar to the “preserve” system that you’ve hit upon, except that the preserves change location over time based on the number of predators, and the prey group into herds.
- high_5 7y agoHeh, this reminds me of The Matrix an Zion.
- Symbiote 7y agoAt secondary school, probably around 1998 or so, there was a Windows desktop program called, I think, "Creatures". ...and I've actually found it, via a 2001 book for school science teachers [1], which leads to archive.org [2] which even has the .exe to download. Before we had internet access on every computer, this was one of the more fun things to play with on the school computers. You can see it's possible to adjust the sunlight, grass death rate, fox hunting ability, rabbit death rate and fox death rate. The "Disasters" menu had things like "Meteorite blocks sunlight" or "virus spreads through foxes"; these were often fatal unless the parameters were perfect. [1] https://books.google.dk/books?id=8W3XJkeF9WUC&lpg=PA91&ots=JDxgERZkiR&pg=PA91#v=onepage&q&f=false https://books.google.dk/books?id=8W3XJkeF9WUC&lpg=PA91&ots=J... [2] http://web.archive.org/web/20041116110431fw_/http://www.fssc.demon.co.uk/EduSoft/Creatures/creature.htm http://web.archive.org/web/20041116110431fw_/http://www.fssc...
- kajecounterhack 7y agoIf you simulate the food chain more by making the rabbits compete for food (green dots) and the fox birth rate much lower than the rabbits / add starvation to the equation (blue dots that don't eat rabbits with enough frequency disappear) you can capture the Apex predator effect too. Too few foxes and you'll see your rabbits eat all the green and the system similarly collapses.
- stefan_ 7y agoSee also https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equations#Dynamics_of_the_system https://en.wikipedia.org/wiki/Lotka%E2%80%93Volterra_equatio...