Sunday, January 30, 2011

Simulated Evolution

BoxCar 2D is a really compelling simulation of natural selection. It uses a genetic algorithm to "evolve" 2D cars that drive over a bumpy landscape. Cars that manage to get further along the track are more likely to "reproduce" and pass on their traits. Here are some of the cars my trial of the sim started out with:

Clearly, these initial models didn't get very far, but the one on the right (for example) might live on to reproduce, and combined with random mutations, the population gradually improved. When I watched closely, I could actually see certain advantageous traits spread through the population. For example, the green and orange spike sticking out of the left car below acted as a stabilizer to keep the car from toppling backwards. Later a small wheel appeared on the spike (see right car below), which greatly amplified the benefit.

There were certain bottlenecks – steep slopes, large ditches, etc. – that were difficult to overcome, but over time some body types managed to get past them. Eventually what I tended to get were quick, adaptable cars with fairly low centers of gravity and no pointy shards sticking out to slow them down. Here's one from Generation 50:

Of course, this simulation doesn't perfectly reflect all the nuance and complexity of natural selection in the wild. However, it does demonstrate the power of the concept. It's all well and good to say that the best-adapted creatures survive and reproduce, but to see it happen before one's eyes is uniquely exciting. Creationists seem to think that evolutionary origins are in some way repugnant or shameful, but if anything, to be part of such a remarkable process should be considered an honor.

No comments:

Post a Comment