This week and last I'm having fun using AgentCubes to teach programming to gifted middle schoolers (the link is to the Frogger activity, but you can close the video and make whatever you like). One of the activities was designing a simple ecological simulation. It's very easy to set something up where there are, say, cows and grass, and the cows eat and reproduce, while the grass reproduces. But it's hard to tweak the parameters (reproduction rates, movement speeds, hunger thresholds) in a way that makes the simulation stable, with the population neither going out of control nor collapsing.
Here's a very simple simulation, with sexual reproduction (red bulls and white cows), and some immortal snakes that symbolize other dangers thrown in. But eventually the cow population explodes, destroys the grass, and we're left with just the immortal snakes.
When thinking about the problems that natural selection needs to find solutions to, it is easy for non-biologists like me to think primarily about individual immediate challenges: how to find a mate, how to reproduce, how to avoid predators, etc. But there is also the problem of avoiding unstable ecosystems. And these problems seem to me to be in one sense more difficult to find natural selection solutions to: it is only after a number of generations that one can evaluate whether the problem has been solved, and so the evolutionary process must be slower and there is the danger that variations that are ecologically beneficial in the long term might have enough short-term unfortunate consequences that they be selected against. Nothing new to biologists, no doubt, but I hadn't realized this.