📜 ⬆️ ⬇️

Game "Life": model the evolution

In the comments to my previous post “The Game of Life and the Modeling of Natural Selection”, the first thing that was suggested was to add a crossing so that the new cell would receive not a copy of the genome of one parent, but a mixture from several. I suspected that the outcome would not change. But, having turned the idea in my head, I became interested: after all, this is how you can get a model of not just natural selection, but already a full-fledged evolution. Fortunately, it was not difficult to implement. So meet: “Life”, now with crossing and mutations .

Well, yes, also with mutations. Simulate, so simulate.

Details, as usual, under the cut.

It so happened that I got "alien" cells, which need not 2, but 3 parents for birth. It would be possible to change the rules of the game, but who am I to argue with Conway? I had to work with what is. As a result, I made the nascent cell receive as the value of each gene the value of the corresponding gene of one of its three parents, selected at random. Plus, I have somewhat simplified my life by the fact that genes are taken only from direct parents, i.e. genes of grandmothers and great-grandfathers in the cell can not appear. For the first approach, this is enough.
')
Since we are talking about changing the genome, it was a sin to bypass the topic of mutations. I made sure that with a certain probability (by default 0.01) one of the genes of the cell was mutated — set to a random value (0/1).

Well, so that my wards didn’t seem like paradise at all, banned the activation of genes 2 and 3 in the first generation (which, as we remember, are responsible for the maximum fitness of the cell to the rules of the game). It turned out that the most adapted cells [0,0,1,1,0,0,0,0,0] can appear only as a result of mutations fixed by natural selection.

My expectations were met almost completely.

Observe the life of the population, which is obtained by the default settings. Note: in the first generation of active genes 4. Ie Not only are they all “wrong”, they are also interfering with genetic debris, when the “right” genes in the cell do appear.

Initially, all cells are red and blue. And quickly die out.


If there are more than 4 active genes, they die out so quickly that the population can completely disappear. But with 4, some foci of life continue to glow long enough that, due to mutations, cells with 1 “correct” gene will appear.


Littered with unnecessary genes, dirty brown, but they still do not die, but multiply, gradually turning green.



And now we see the ideal appear [0,0,1,1,0,0,0,0,0]. They not only acquired 2 necessary genes, but also got rid of the “garbage” interfering with living.



And now they are gradually winning over the living space of their less perfect relatives.



Unfortunately, I could not wait for the moment when they won a complete victory. Most likely, the matter is in the limitations of the universe. When the number of cells reaches saturation, the power of natural selection weakens. The cells are so close to each other that for reproduction it is no longer necessary to have the most efficient genome: there will be neighbors anyway.
It is possible to continue the action of selection, for example, by arranging periodically “cataclysms” that kill a part of the cells, but I decided that some very artificial conditions were already obtained.

The main thing is that the result has been achieved: in a system that lives by simple laws , we have seen the emergence of an “ideal” cell that did not initially exist from ancestral cells far from ideal.
Impressive.

Source: https://habr.com/ru/post/154387/


All Articles