Grazers eat the green food. Hunters eat the grazers. An animal with enough energy has a young, and the young gets the genes of its parent with small changes. You do not control an animal: change the land, and see what evolves.
The land lives.
| Gene | Grazers | Hunters |
|---|
The average of each gene of the animals that live now. A number in color changed from the first animals.
Each animal is a gen_boid process. A young is a new process that its parent starts. An animal with no energy stops, and the world removes it.
The rules of an animal (stay close, flee, seek food, chase) come from its genes at its birth. So do its speed and how far it sees. A fast animal with good eyes uses more energy.
A grazer goes to the nearest food that it sees: handle_sense/2 adds the food to what the grazer perceives, and a function of the grazer is one of its rules.
A hunter that touches a grazer calls the process of the grazer. The grazer gives its energy and stops. When two hunters touch it, only one gets the meal.