📜 ⬆️ ⬇️

Creating "artificial life" on the computer

Hello. In this article I want to describe my experiment on creating “artificial life” on a computer.

What does this look like?

the picture is clickable
')
A virtual environment with its own rules is created on the computer and the first simple animal is released. I will call them bots. Bots can die or survive and give offspring. A descendant may differ slightly from the ancestor.

Well, then evolution and natural selection are taken to work.

And I can only observe the development of the world.

The more surprising for the creator and the more varied the options for the development of the world, the more successful the experiment can be considered.

The behavior of the bots is controlled by the code written in them.

That code is the genome that is responsible for the behavior of the bot and which will change in the process of evolution.

The internal structure of the code is the most interesting in the project.

The code should be simple and withstand various modifications (random change of any element in the code) over itself without syntax errors.

To the code, we will return later, first describe the world itself.

Description of the "world of bots"


The world is a two-dimensional, divided into squares field. Horizontally, it is closed in a circle, that is, if the bot goes beyond the left edge, it will appear on the right side. From above and below the movement is limited by a wall. The world, according to the idea - is a section of the reservoir, the higher, the more energy can be obtained from the sun. In the lower half of the energy of the sun is no longer available. Actually, this is enough. I started experiments with this world.

Then added "minerals" at the bottom of which you can get energy. The deeper, the more "minerals" the bot can get. After that, the lower part of the world also became populated.

Bots can move in eight directions and probe adjacent cells.
Bots can eat other bots that are on a nearby cage.

Bots accumulate energy and when they accumulate a given amount, their clone buds off from them.
In the clone, the same program is written as in the parent, but in one case out of four, one byte in the program changes randomly. This may not affect the behavior of the clone, since not all commands in the genome program are executed, most of the genome may not be involved. It can also cause a deterioration or improvement in the ability of a bot to survive in this world. In the first case, the bot will either die or will not be able to leave many descendants. In the case of improving the abilities of the bot, he is more likely to leave more offspring, which will displace less successful neighbors.

Bots do not die of old age. A bot can die if its reserves of energy become below zero, if another bot eats it, and if it has accumulated the maximum amount of energy, it should budge a descendant, but is surrounded on all sides and cannot do it. After death, if it was not eaten, the bot turns into organic matter, which begins to sink until it encounters an obstacle. After that, organics remain in limbo. Organics can eat other bots.

Here I gave a brief idea of ​​the virtual world of bots, sufficient for understanding the further material. Actually the world itself is not so important, you can experiment with different worlds. Much more interesting how the code-genome works

Gene coding


- . — ( ). ( ), , , . , , . 64 . , . , ( ) . , . . 64 , 64 ( 0 63).



. 23. «». , , , . . , , , . , «», . -.



, 1 63. , 0, «», 1. 1 — 63. , . 63 «», . . , , 64.

, .

. , 8 , .

64 (0..63) . .



, 25 «». 25 (), . , . 0 63, 8. , 8 . 8 (0..7) — , . (64) 8. . , , , .

, , . . , « », .

, « ?» , , , , , . 1 1000, 0 63. , , 15. :

0, 15, 30, 45, 60 ...... 945.

. .



() 10.

№10. 33, « ?».
(+1), , .

14*15=210

210, +2.
23. .

10+23=33.

33 №33

, 210, +3.
8. .

10+8=18.

18 №18

, «», « », «», « » . , , , .



() 7.
№7. 26, «».
(+1), , .

18 % 8 = 2

, , , +2.
0. .

7+0=7.

№7. , .

.

, +3.
3. .

7+3=10.

10 №10 , , .

, +4.
43. .

7+43=50. 50 №50
, +5. 24. . 7+24=31.

31 №31

, +6.
59. .

7+59=66.

66. , 64 2 №2

, , . . . , .

, - , . , , .

.

. , . : «», «», «», « » . ( , «», «», « ?» ) 15 , .

, .


, . , , , . , «» «» , . 25 . , , , ,

. , , «».

.

. , «» , .
.

, , , , .



. «»,







. - .

.



( ) .
, «» . , 4 8.



. , , .

. , .

. . , .



. , . , . , ( , ).



, , , . .



. , . . (-) .

, 7- , , , . , RomanoBruno Java. . .

, , . .

, « ». - .







21 . , .



347 , .



2000 , . , . , , , .

, , .


, , .

, «». «» , .
, , - . . .

- , .


<> , , . , . , .</>


, , ( ). -, , , , . , , .

, , .

-, , .


, . 93 « ». . , - .


, .

Pixilang
yadi.sk/d/rLamoeyt3NBRwL

RomanoBruno Java GitHub.

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


All Articles