Game “life”, Chaos, “black swan”, ethnogenesis and how it is all connected

image

I quite a long time on Habré. Looking through old ratings, I noticed that people are not indifferent to the game “life”. In this regard, I decided to share my version of this game.

In principle, my version is based only on the classical rules - I was interested in creating a dynamic system. Because of this, the game contains predators and victims, mutations, cannibals, dynamic equations, and much more.

image

To whom it is interesting I ask under ...

The game


The game mimics a predator-prey relationship.

The life cycle of victims is based on the rules of the “life” game: for reproduction, a certain number of neighbors is needed, but if the number of neighbors is more than certain, then the victim cell dies. Death is final.

The life cycle of a predator cell is based only on the ability to reproduce. Predators can and should eat in order to breed.

All creatures have initial parameters that can mutate (increase, decrease) in the process of reproduction. At the moment, there is only:

• life priority (nutrition, security, isolation = loneliness, reproduction) - an individual’s behavior strategy - determines the next move;
• Strength - affects the chance of one creature to triumph over another (relevant only for predator cells);
• vision - determines the maximum distance that a creature can see (field of view);
• speed - determines the maximum distance that a creature can travel in one turn;
• life - the number of moves;
• whether the cell "Black Swan" ( Black Swan ) - "Black Swan," a creature whose movement is determined by a dynamic formula ( " Chaos Theory "). All creatures of the same species, “seeing” the “black swan” strive for it (life priorities do not play a role) - this gives an additional level of randomization;
• "cannibalism" (relevant only for predator cells) - the ability to feed on individuals of both species (in order to eat a creature of the same species, a cannibal cage must first triumph over it).

For each creature, the parameter values ​​are randomly determined at birth.

All predator tribes are in a state of war or peace, which is determined randomly. If two individuals from warring tribes meet on the same cage, then they enter the battle, the result of which depends on the value of strength. Thus, using the statistics window, you can watch for their development or attenuation.



Designations


The green triangle (the bottom in the cage) is the victim;
The red triangle (the top in the cage) is a hunter;
The blue triangle (right in the cage) is the heir to the hunter this turn;
Black Triangle (left / bottom in the cage) - black swan hunter / prey.

I would be glad if readers share their ideas, how can the existing functionality be expanded? What else would be interesting to stimulate?

Control


To place the predator tribe: hold down the right mouse button on the field and move in any direction - a red halo appears, which determines the Gauss distribution of the tribe.
If you spin the mouse wheel at the same time, you can increase / decrease the dispersion of the distribution.
To place a tribe of victim cells, hold down the left mouse button on the field and move in any direction - a green halo appears.

image

Additional information can be found under the "Help" button.

You can find out the statistics by clicking on the “Run Time Info” button.

The code was written when it just came out with ++ 0x and it was interesting to deal with lambda expressions and also see how their use really improves performance.

Sources and executable can be downloaded from here: Game Of Life Repo

Also popular now: