Back in my university days I had the great honor of contributing to one of my professor’s textbooks, Great Ideas in Computer Science by Dr. Alan Biermann. I contributed to the Simulations chapter, specifically pp. 198-202. I can’t say I’m proud of the code (or any code I wrote in school) but it sure was fun.
The idea was modeling evolution with a genetic code that translated into operations (e.g. move, rotate, eat) and finding mates. Mating would produce offspring that spliced genes from each parent. Iterate until all the entities are dead. Then the exercise is to look at the final generations and the properties of their genetic code.
I did my simulation in C, but much cooler simulations have been done in Lisp where the genetic code really contained code that could be modified as part of procreation or random mutation. Some day I’ll need to revisit this project.