AI survival simulation

This is an AI simulating simplified life & survival, inspired by Tierra. I wanted to not only reproduce this experiment, but take it a step further and observe other behaviour resulting from this. To do this I also made the programming more friendly and intuitive. Additionally, I separated out what is possible for entities to do, and things governed by laws or reason such as preservation of mass and energy.

Instead of common models that are trained with fixed data sets, this is a competitive in situ evolutionary system. The simulation starts with a single entity, programmed with a basic set of instructions in the form of Condition -> Action. Besides entities there are resources that can be absorbed / consumed. These conditions / actions are stored in the entity, so each hold it's own flexible set of instructions. Additionally each entity has mass, energy and a unique identifier. It also has a version number corresponding to an instruction set. This is the standard instructions set:

 

Conditions Action
Energy:Low Unit:Entity Version:Different Move
Energy:High Unit:Entity Version:Different Engage
Unit:Resource     Engage
Unit:Entity Version:Same Incomplete Program
MassEnergy:Clone Unit:None   Clone
Unit:None     Move

 

The first action is it's highest priority, as only one action is performed - meaning it's a bit like an If / Else flow. A few key actions: if a resource is encountered, engage it (which means it will absorb it), and if enough mass and energy is available, clone and generate a 'child'. This initial set contains 19 instructions, stored sequentially in the entity.

The environment is a one dimensional 'world' where the entity can move in. A simple representation is to loop the dimension into a circle as to best use the screen, at the same time limiting the 'world' to effectively loop around. Entities are visualised by a core with a unique ID number (intensity representing the amount of instruction completeness), a blue circle representing mass, and an outer red circle for the amount of energy. Resources look similar except it shows a blank centre. Entities can only engage with others while at the same location. The simulation starts with a single entity (ID '1', version 0), and an abundance of resources.

tierrai1small

When an entity is cloned, there is a chance of mutation. This means at random one condition/action will be removed or added. Note that cloning takes mass, energy and time equal to the number of instructions. So less instructions is beneficial. However, without essential instructions such as absorbing resources or cloning, the entity is heading for extinction.

The game is about surviving in a competitive environment. So when an entity encounters another with a different version number, it will 'attack' it. First the energy will be expended, at the same time breaking down the energy 'barrier' of the other entity.

Note that all this behaviour is dynamic, captured in the instructions of each entity. The centre of the screen shows how many entities of each version there are, indicating how 'well' a version with corresponding instructions is surviving.

tierrai2small

Selecting a version shows it's instruction set for further analysis.

Although the experiment could be expanded more, it already reveals some interesting patterns. For example, it showed this mutation was out-surviving the standard instructions:

 

Conditions Action
Unit:Resource     Engage
Unit:Entity Version:Same Incomplete Program
MassEnergy:Clone Unit:None   Clone
Unit:None     Move

 

What's of particular interest about this, is that this entity does not engage with other entities, and would try to avoid - but at the same time lose in a sustained encounter. But because it's significantly smaller (only 11 instructions), it multiplies easier, and overall effectively survives better.

Download Tierrai here