Here is the link

Evolution simulation


I have always wondered if evolution can be simulated or not and decided to try by myself. Even though I truly believe that the evolution does exist and work in the everyday life, seeing soemthing with your own eyes makes you feel it to your bones, just like seeing a planet by a telescope for the first time. You know that it is there, but when you see it with your own eyes, you experience a special moment.

Genetic algorithm is nothing new and it does work. I have used this technique a number of times and each time it was successful. So to simulate life, I knew that I had to use it.

How to simplify

Life is complicated and to truly simulate it would require to simulate all the sub atomic particles. Obviously I had to simplify it. But how simplified it should be? Well what I am looking for is a result which would surprise me as the programmer. I should only set the rules at the beginning and let the nature do the work. To achieve this, I decided to keep it very simple, because if it was suppose to surprise me, a simple environment and a couple of creatures would still be able to provide that. Therefore I chose to add only 3 types of living beings:

Living beings



I knew that every entity should have had their DNA in order to use Genetic Algorithm. I didn’t make a list at the beginning and went with the flow. While programming, all the attributes appeared by themselves anyways. Obviously, hunters will be hunting preys and preys will be eating plants. So the plants should not be mobile but the others should. That self-defined the first DNA attribute, lets call it a Gene. So if they are mobile, they should have a speed. So the first gene is their speed and it should be between 1-99 (cause why not). And then I have decided on the other attributes that most living beings do share such as when to start running away from a hunter, what is the hunger threshold, sex desire, food storage capacity, when to start searching for food and so on. Every single attribute will define these simple creatures.

The rules

What to expect

I was expecting some behaviour after I set the rules and defined the environmental variables


After watching it hours, it started to surprise me a lot and to be honest, I learned a lot from this simulation. I know it sounds crazy for the programmer to be surprised by it’s own creation, but I didn’t really invent this nature, I simply created a laboratory to observe the existing nature.

First of all, I realised there are no perfect species. They come and go. Even though there is a perfect hunter, a perfect prey, they all disappear in the end and always new species appear. Lets dig into this a bit. A perfect hunter kills everything around it and eventually starves because there is nothing left to eat. So it is not always a good thing to be a perfect hunter. This made me think about human race, we are very good at many things and no other species can compete with us. But if we are not careful about the resources, we will end ourselves just like the perfect hunters.

On the other hand the perfect prey disappears after a while as well because no hunter is capable of killing them, as long as they are around, the hunters don’t get the chance to evolve enough to get strong and the new randomly created hunters are inepts. That leads them to get better and better at standing by and not wasting any energy, wait for the food to appear and as soon as they appear, they attack and get everything. Also they tend to store as much as possible. But once there is famine, they all die at once and disappear from the face of the earth. This also tells a lot about nature, whatever we do, we are depending on the nature and it is unreliable. If a single variable changes like the global warming, no matter how skillful we are, there is nothing to save us.

While preys are feeding, if there is a hunter nearby, they don’t get close to there (you can see a red stroke around the prey when this mod is on). Some of them has lower “fear” thresholds so they don’t really care, you can think this as badgers walking around lions. Being too shy is not always a good thing because they can starve because of the hunters near to the plants. This reminds me the antelopes going near to the water knowing there is a corcodile in it.


It is possible to get surprised by the nature even with a simple simulation. I enjoyed watching it for hours and witnessed many interesting unexpected behaviour. I hope you enjoy it as well.