url: 194 Evoluzione simulata
I'm working on this Java port of SimEvol, a C program I wrote for my Amiga way back when. The original idea is from a Scientific American article by A.K. Dewdney.
This world consists of bugs (the small, colorful, moving squares) and their food, randomly placed stationary bacteria (the purple dots). Bacteria are added to the world at a slow, steady pace.
The bugs eat their food by moving onto it, and they move strictly according to their limited genome (they have no sense organs to help them detect food). The best genome is one that keeps a bug moving mostly in straight lines, turning only occasionally; this keeps a bug constantly moving to new areas, rather than exhausting the local food supply and then slowly starving. (The bugs don't get stuck on the sides of the world because the world is logically toroidal -- that is, when you fall off one edge, you reappear at the opposite edge. Fall off the top, reappear unharmed at the bottom.)
The bugs' genomes are initially random, so they tend to wander in little circles. (Dewdney calls these ``jitterbugs.'') Since a bug's best strategy is to move mostly in straight lines, these bugs usually die fairly quickly. One or two, a little better or luckier than the rest, survive for a while, mostly spinning in place. If they're really lucky, they survive long enough to bear offspring.
Meanwhile, food has been building up all over the world, just waiting for bugs to come along and eat it. The bugs are happy to oblige: using the abundant food, they begin to breed explosively, doubling in number every few hundred ticks of the simulation's clock.
But soon, the number of bugs begins to outstrip the food supply. Most bugs have stored enough food to survive a while. But then the inevitable happens, and they begin to die off in great numbers.
The bugs that survive this first die-off are those whose DNA programmed them to move a little straighter than their compatriots, or those that were lucky enough to be near a food-rich region when the die-offs began. (A given bug is progressively less likely to be lucky every time there's a food shortage, though, so luck is a short-term effect.)
The population continues in this vein for some time: repeated boom-and-bust cycles of various sizes, each cycle rewarding the bugs that move straighter than their competitors. After a number of these cycles, the surviving bugs have evolved pretty effective genomes (that is, they tend to move in fairly straight lines, especially as compared to their ancestors).
At this point, the population settles down to a more or less constant figure. (The exact figure depends on the amount of food being supplied per unit time -- obviously, more food supports a larger population.) The bugs' DNA now enables them to gather enough food that they rarely die, but they also rarely build up enough strength to breed. The dramatic boom-and-bust cycles are over.
The bugs' colors have meaning:
Also notice the scrolling graph above the bug-world. This shows the average ``straightness'' in the bugs' genomes -- that is, the odds that a bug will decide to go straight instead of turning at any given tick of the clock. If it's 80%, that means the bugs are moving straight for 8 moves out of every 10, on average. You'll see this straightness indicator rise over time as selection pressure takes effect, reflecting the value of moving straight in the bug-world. It usually ends up in the neighborhood of 95%.
If everyone dies, the applet restarts automatically.