Ejemplos de Vida. Ants and Plants

Author of the program: Manuel de la Herrán Gascón

Ants and Plants

Pulsate To begin for to see the evolution of the ants. Exist five types of ants that accomplish a or other action with determined probability in function of if if find with other ant, a plant, both or no. These probabilities it is they can to modify.

For example, aunqe exist 5 colors for the 5 types of ants, we can to make that the four first may have the same probabilities, it that would be equal to to have only two types of ants.

Hormigas y Plantas

In this program we will see a world of two dimensions in the that live together ants and plants. The plants grow when they are watered. The ants they can to eat plants, it be moved, to water plants, it be fought and it be reproduced.

The ants earn energy each time that eat a plant. When a plant there is been sufficiently watered, it will be food for the first ant that pass together to she. Not there is limit in the quantity of plants that a ant puede to eat.

The ants lose energy each time that it is move, water, it is fight or it is reproduce. If a ant lose all its energy, dies. For other part, each certain time born a plant espontaneamente.

The aspect of the screen with the ants in movement correspond with the process real that it is produces internally in the simulation. Is possible to conceal the vision of the ants for that the process it will be more rapid.

In a combat, the ant winning it is will remain with the half of the food-energy accumulated for the losing. Furthermore, how much more times leave winning a ant, so many more probabilities will will have of to leave victorious of the following fight. For example, if a ant has a probability of to earn the fight of 50, and the earn, the next time the probability it will be of 75, the next of 87,5. For to increase, it is increase the half of it that to him lack for to arrive to 100. For dismuinuir, it is reduce to the half. Thus they can to increase and to reduce until the infinite.

If a ant not possess food, the we declare died. In case opposite, the ant observe if exist plants or other ants to its around. If exist plants edible, it is the eat. After, it will be able to water the plants that yet not they are edible, to fight or it be reproduced with its neighboring, or simply to follow promenading for its world virtual.

Is possible to create obstaculos in the world where live the ants and to observe thus different populations according to the zones.

In this program we have 5 types of ants. The probability of that a ant accomplishes a determined action will depend of the type of ant and of the individual with that it is find.

When two ants it is reproduce, it is create a new ant with characteristic similar to the of the parents. For example, a ant of type 1 (red) and a ant of type 5 (green) will generate with great probability a falling of type 3 (orange). Furthermore, for that the society not it is reservoir in a only type of ant, it is will permit, for example, that two ants green produce a red (mutation); that yes, with a rate whose value it is puede to modify and that normally it will be decrease. The new ant will born in a point free anyone of the map or in the first cell more nearby to the ants progenitoras.

Hormigas y Plantas

Tipos de Hormigas

These and other options it is they can to modify. Though exist several examples with options preset, is possible to modify any example, creating thus other worlds and other behaviors.

This table is in reality very simple. The ant red is the more egotistic. Never water, and when it is find with other ant, it is devote to to fight or to it be reproduced

The ant green is the less egotistic, not struggle never and it is devote to to water all the plants that find to its step. The rest of ants they are terms means between these two extreme.

Is evident that the ants of the type green they are the base on the that it is sustain the society. Is to say, if not there is who water the plants, these not grow, the food it is end and the ants die.

Proving the simulations with different values us we give account of that there is something that always it is produces. Enough with to execute the program two or three times for to see it. ¿That it will be?

Behaviors cyclical

In the world artificial of ants and plants, the action of "to water" is a act that impinge in benefit of the population completes, already that when a ant water a plant not it is assure that it will be she same who the comma after.

A society formed solely for ants red would die quickly of hunger, already that no would water the plants. A society formed solely for ants green would enjoy of great prosperity.

But in our simulation always there is ants of all the types. They could to appear ants red voraces and almost unconquerable. But the ants red depend of the other, already that they are for definition unable of to water.

Exist a behavior cyclical in how much to the number of ants of each type and also between the number total of ants and the number of plants. If in a first moment there is great quantity of plants, more late it will be high the number of ants, already that these they will be able to water and to eat, and to reach the level of energy necessary for it be reproduced.

But to the have many ants, the plants disappear devoured for the ants. More forward, to the have many ants and few plants, not will exist food for all, and the number of ants will decrease. A time that we have arrived to the point in the that exist few ants and few plants, will begin the increase of the number of plants, repitiéndose the cycle.

These processes regulares it is give in the nature, between kinds that they are depredador and prey, and also in our society, in the concepts of offer and demand. For example, when certain year the quantity harvested of a product agricultural is very small, the price rise, already that the product is difficult of to obtain. This increase of the price encourage to the farmers, that they have observed the profitability of this product and for so much the year following it is cultivate in greater quantity. The result is a excess of production that provoke that the price decrease. Now the interest for to cultivate this product reduce, and again it will be scarce in the following year, repitiéndose the cycle.


The execution of 100 ants is much more slow that the execution of 10 ants. In some moments puede to seem that the ants delay much in it be died when not there is food, and without embargo it only that occur is that the cycles it is happen more slowly.

The world it must be of a dimension of to the less 3x3

In this program we have 5 types of ants, whose possible actions to to accomplish possess different probabilities in the case of it be found with a plant, with a ant or with both. In the program exist five types of ants. The red they are the more "egoistas" and luchadoras, while that the green they are the more prone to the collaboration. The rest possess attitudes intermediate. But these data also they can it be modified.

In first place if the ant not possess food, the we declare died. In case opposite, the ant observe if exist plants or other ants to its around.

If exist plants edible, it is the eat. After, it will be able to water the plants that yet not they are edible, to fight or it be reproduced with its neighboring, or simply to follow promenading for its world virtual.

A time that two ants they have fought or it is they have reproduced, it is the separate for that not enter in a curl of fight or reproduction continuous.

The food provide to the ants the force necessary for it be moved, to water, to fight or it be reproduced, and die in the case of to lose all its force.

The quantity of water initial of a plant is 0

All the ants will eat always that find a plant that there is been sufficiently watered, already they will be ants green, red or of other color, and not there is limit in the quantity of plants that a ant puede to eat.

The ant that it is fight find always other disposed to it be fought. When two ants fight, both lose a quantity of enrgía preset of beforehand. If the that it must to begin the fight not possess that quantity, the fight not it is produces.

The ant that it is reproduce find always other disposed to it be reproduced. The ant of who part the initiative lose energy, but the other not. If the ant that it must it be reproduced not pose the energy necessary for to make it, not it is will reproduce.

The ants not die in the combats, but yes they can to make it for lack of food.

The purpose of to offer the possibility of to separate to the ants of a plant after of have it watered is to permit that the fact of to water supposes a behavior that benefit to the society in joint, already that if not it is made this, the ant would eat almost always the plant that she same there is watered.

When a plant (circle) there is grown thoroughly and puede be food, its color it is returns green more obscure and appear a brand in its center.

After of a execution, the program sample some graphics that represent the evolution of the number of ants of each type and the number of plants

Example of graph of the evolution of the number of ants and plants

Example of graph of the evolution of the number of ants and plants

[Back to Index]

To download source code

This program and its files source they are free of charge and of free distribution. The code source it is available and puede be modified, distributed, or used in other programs with deposit freedom.

For to obtain the last version of the program, for to suggest possible amplifications, if it is detected some mistake in the programming or if wish to communicate that it is is going to to widen or to use a part or all this program, not doubt in it be put in contact with the author in the address: E-mail

Click here for to download source code.

[Back to Index]

¡You are guest to to hold, criticize and collaborate with your ideas!
Send your commentaries, questions, suggestions, or criticize to to the following address:

[ Home Page Spanish | Home Page English ]
The software of Gaia is free, sources available. There is not
commercial interests, only to research and amusement.
You can send your suggestions about
the face of the web or its contents to the E-mail