Thanks to Andrej Karpathy, I have code that simulates evolution. He wrote code that has a population of herbivores and carnivores and they have inputs and behaviors that are complex and can evolve. The physical attributes cannot evolve and each creature is fixed with sign and hearing and can move and attack or eat. The “world” they populate has random food sources for the herbivores.
I’ve run the simulation as-is and also modified it to experiment with how the various program variables affect the results. The unmodified code from Andrej Karpathy ensures that there is always a population close to the desired size. It doesn’t guarantee that there are equal numbers of carnivores or herbivores, as far as I can tell. The program has graphical output but that can be tuned to get in more simulation time or turned off to run the simulation as fast as possible. After a while, creatures that are good at surviving reproduce and there are lots of that particular creature around.
I modified the simulation to remove the population control feature and to make reproduction a-sexual. Creatures eventually produce offsprint that are “genetically” close to the parent but not identical. this modified version took some tweaking until I could get a semi-stable population. It is semi-stable because the counts of herbivores and carnivores go up and down by large amounts but when one it “too high” or “too low,” the other population adjusts itself and the low counts go up or the high counts go down. This oscillation happens constantly as it did in the original version but my version has larger swings and sometimes there is an extinction where all carnivores are gone.
Some of things I want to do are related to either physical evolution, mating reproduction, or neural networks. The physical evolution of these creatures could be handled by giving them a limited amount of energy and letting them evolve stronger and weaker senses and actions based on the energy limit. A creature that is fast might not have enough energy to have good eyesight. Some creatures could evolve to limit energy use overall and therefore, live longer. I want to explore how this could work and see if interesting things happen once it is implemented. the only difficult part of this work is that the population needs to live long enough to evolve before becoming extinct.
In real evolution, there may have been billions of situations where chemicals formed bonds that could lead to reproduction and evolution but there was at least a billion years for that to happen. I don’t have that time available so I need to tune the simulation to allow for survival and evolution right off the bat.
The mating reproduction may not be a big deal but it would be interesting to add it to the mix. Unfortunately, the creatures and the environment are very limited and mating might affect the creatures too much to allow for survival. After all, the simulation starts with each creature essentially being it’s own species. There is no guarantee that two successful creatures could find each other and produce successful offspring before the entire population dies out. I just don’t have enough creatures to guarantee that it will work at all. Real life started as a successful “create” without reproduction and reproduction was probably a-sexual anyhow.
The neural network aspect of this is unknown to me. Andrej seemed to have video of an earlier simulation that used neural nets for senses and behavior. Apparently, the current simulation uses a large set of inheritable and mutable rules, instead of a neural net, and it works just as well in this context. I would only explore the neural network to learn about that particular technology.
I’ll keep tuning the simulation so that I can get these semi-stable populations fairly often and then see if I can slowly add the other concepts and features one at a time.