Simulation of life in the Darwinbots system. I. First acquaintance

Hello, Habr!

He recently completed a coursework on genetic algorithms in the Darwinbots program and decided it would be interesting to the community. Moreover, at the moment, the project community is quite small. Articles will be half translation of the documentation, and half their research program.

1. First acquaintance

2. Simulation and the simplest bot

So, the program Darwinbots is a simulator of artificial life. The first versions were written by the Italian programmer Carlo Comis using the programming language Visual Basic. The latest version of the program at the moment is 2.45.02D, released on August 21, 2012. Currently, the third version of the application, completely rewritten in C #, is being developed. There is also a port in C ++. The source code of the project is published in the Subversion version control system and is available to everyone.

The program imitates the life of a population of organisms - bots (robots), whose DNA is described manually using a specially designed language. DNA, in fact, is a large finite state machine that reads information from many different inputs, modifies it and connects to the conclusions with actions. The bot code (hereinafter referred to as DNA) is described in a text file with the extension .txt, which allows you to work with it in any editor, including Notepad. The essence of the simulation is to perform DNA for each cycle, taking into account the possible interactions of organisms, mutations, viruses, and so on.

The main element of the interface of the Darwinbots program is the world of bots (or the modeling field). The world of bots is a large non-discrete plane (yes, that same blue rectangle that was before). By default, bots can move all over the world. World settings are set in the simulation settings.

Each bot is represented by a circle of a certain size and color, with some pattern in the center. The "eye" of the bot is indicated by a white dot. It includes 9 simple peepholes. When you select a bot on the modeling field, you can see the grid from the fields of view of each eye. The eyes transmit to the program a value approximately corresponding to the size of the object that has come into view.

The bot has a system of simple tactile sensations, which allows it to feel a collision or attack from the side of another bot. The sensory inputs of bots are analyzed in DNA, which is written in a language using the FILO abstraction (“first come, last leave”, according to the principle of plates placed on top of each other). The DNA of most bots has from 6 to 20 procedures called genes, in which up to 200 operations can be performed. Each operation can mutate.

Each bot has its own energy reserve. Most activities reduce the amount of energy. When the energy becomes equal to zero, the bot will die, and when it becomes higher than the level defined in DNA, it will begin to multiply. Energy can be replenished by absorbing other bots (an analogue of hunting in an ordinary environment) and energy reserves from your “body”. If the bot is selected as an autotroph, then energy is automatically replenished for a long time.

The bot can shoot intangible shells, attack, remove trash, become infected and exchange information with other bots. A projectile is a point on a modeling field that does not have mass and physical dimensions.

The bot can also communicate with other bots, forming a complex multicellular structure, inside which bots can exchange energy, operations and move around the field.

When a bot multiplies, its DNA is passed on to the offspring, sometimes with some changes that affect the bot’s behavior. As in the real world, evolution can occur with a change in DNA - the next generation of bots may become more able to attack, multiply, avoid contacts, and so on. Such mutations are either passed down from generation to generation or disappear. Over time, unwanted code can accumulate in the DNA that does nothing useful. It will take more energy and make DNA more loaded.

Since the program does not decide which organism to grow, the bot's abilities are manifested in the long run by a combination of movement strategies, energy management, reproduction, etc. There are no restrictions on the complexity of the DNA code.

Evolution in Darwinbots takes quite a long time. The generation of bots can live several thousand cycles, and most simulations operate at a frequency of about 15 cycles per second, so from a few hours to several days it can take up a significant natural selection.

Of course, in this introductory article, I was hardly able to interest you in this project, but, as a decoy, I can tell you that the program has an Internet mode (a kind of PvP), and bot developers can take part in leagues - a kind of competition.

In the next article, we’ll talk about simulation settings and bot programming.

And finally, pictures to attract attention:

A second later:

After a few hundred simulation cycles:

See you!

UPD: Friends!
Please answer the question about the future continuation of the article here. Thank you in advance!

Also popular now: