Bugs

On the muddy bottom of a pond a number of protozoa cruise around eating dead bacteria which rain down from above. Their endless search for food takes energy and those who do not find enough nourishment will die. Java capable browsers will show a microscopic segment of the pond which receives enough food to support about 40 protozoa.

The behaviour of the protozoa is controlled by 6 genes which determine the probability of turning by a particular amount.

Gene Direction
Forward no turn
Right 60 degrees clockwise
Hard Right 120 degrees clockwise
Reverse about face
Hard Left 120 degree anti-clockwise
Left 60 degrees anti-clockwise

When old enough and bolstered with lots of energy a protozoa will reproduce by splitting into two new individuals. Small mutations mean that these offspring are not exact copies of their parents but share most characteristics. In the competition to find food only those with good genes can eat enough to reproduce. Natural selection encourages the development of particular sorts of protozoa.

In the beginning gene values are assigned at random which causes most bugs to jitter about making little progress but expending a lot of energy. Jitterbugs have a high death rate. After exhausting the locale food supply their energy gradually diminishes unless they chance across a fresh patch. Some survive, most often those who jitter less. Next to develop are tumblers who move round in circles before cruisers take over. A cruiser moves forward most of the time but turns every now and then, forever bring the protozoa into new food areas.

If you want a closer look at the process in action there are two things to do. First click on bit of the banner without any bugs on and a control panel will appear with which you can adjust the speed to something more suitable. Second click on a bit of the banner with bugs on and another control panel will appear, this time displaying information the selected bugs age, energy, and genome. The bug you have selected will now appear yellow on the screen.

Source code for this simple demonstration is available:

Credits

Based on Simulated Evolution: wherein bugs learn to hunt bacteria by A. K. Dewdney in Scientific American, May 1989. This article discusses a program called Simulated Evolution by Michael Palmiter which shows the same behaviour as the applet above.