Since I started programming, I have thought it would be interesting to attempt to approximate life within a computer program. I started this project on my own, but finished it, collected data from it, and wrote a paper on if for my final CS class project.
What my final program does is create a virtual Petri dish with two types of cells in it: predator cells and prey cells. As the cells move around in their virtual environment, the predator cells try to chase down the prey cells, and the prey try to escape the predators. If the predators do not eat for a long time, they die of starvation. As the cells move in the simulation, the also replicate. All of the cells, both predator and prey, have two individual attributes: sight radius and movement speed, which are passed on from parent cells to child cells. However, as the cells replicate, there is a small chance that the child cells "mutate." In other words, one or both of their attributes has a slightly different value than the parent cell's attributes. These random mutations allow for natural selection to occur within the simulation, provided it runs for long enough. The most effective predators will survive the longest, and therefore produce the most offspring, so their desirable attributes proliferate. The same applies to prey cells that can escape most easily. As the simulation runs, it outputs the average attributes of all of each type of cell to a text file at regular intervals. If the simulation is run for a long period of time, these values can be evaluated, and one can see if natural selection occurred or not, on average.