SimEv

Strange View

A genetical model to simulate life evolution

In SimEv you can see the evolution of what I call an entity. Such entities try to collect enough energy to reproduce, following the behaviour of their associated genoma, which is just similar to a basic assembler program. So the entity can have a vegetable behaviour, collecting energy without moving, or an animal behaviour, which may be aggressive or not, or a mix of the two, etc.

You can get source code & DOS executable. Written in ANSI C with the GRX graphic library for the DJGPP compiler and a little bit of curses for keyboard I/O. Since I heard that there is a Linux port of the GRX library, I think that recompiling under that system should be easy. It works with Windows 3.x and 9x, but not with NT 4.0. I'd like to do a Java port, but it's a long time due.

You can get it in the download page.


Technical reference

Entity structure

Each entity has 2 bytes of memory, one is called regand the another mem: reg(register) is accessed by commands, mem(memory) is used to store a value. In fact the value of those variables is a direction and is always between 0 and 8. The 0 points to itself, while the numbers from 1 to 8 point to the 8 directions beginning with up-right and then turning clockwise.

Each entity has also an energyaccumulated and a timethat counts the turns of age. Each turn the entity execute the commands in its genoma until it reaches a command that hat the EOT (End Of Turn) property or has done a number of commands equal to its genoma dimension (to avoid infinite loops). In the next turn it continues from the position in the genoma where the previous turn it ended. If time> MAX_AGE, or energy= 0, the entity dies.

To enhance cooperation I have added the possibility to write down a signalin each place, which can be read by another entity that will move in the same place in the future. As I saw in my run of the program, this feature is not being used very much by the evolved entities.

Here follows a table of the possible commands:

SimEv genoma
Command EOT Description
NOP N No operation. Yes, it does nothing.
ENE Y Adds INC_ENERGY to energyin the direction pointed by reg, only if that place is full. If regis 0 gains INC_ENERGY to itself.
MOV N Move in the direction pointed by reg. If regis 0 does nothing. Moving costs MOV_ENERGY and works only if the next place is empty.
ATK Y Move in the direction pointed by reg. If regis 0 does nothing. Moving costs ATK_ENERGY, but if you find another entity you subtract up to ATK_GET_ENERGY to that entity and you move only if that entity dies, i.e. its energyis 0. Usually ATK_ENERGY > MOV_ENERGY.
REP Y If energy> REP_ENERGY and there is an adiacent empty place, reproduce a copy of the entity into that place, resetting both energies, with MUTATION_PROP on 1000 probabilities of committing an error coping the genoma. That is a mutation. If energy> REP_ENERGY and there is not an adiacent empty place, then entity dies.
INF N Set all near entity regto the content of its own one.
LFN N Look for a not full, i.e. empty, place and set regto the corresponding directions. If search fails set it to 0.
LFF N Look for a full place and set regto the corresponding direction. If search fails set it to 0.
LFD N Look for a place with different genoma dimension and set corresponding direction in reg. If search fails set it to 0.
LFS N Look for a place with smaller genoma dimension and set corresponding direction in reg. If search fails set it to 0.
LFB N Look for a place with bigger genoma dimension and set corresponding direction in reg. If search fails set it to 0.
LFE N Look for a place with equal genoma dimension and set regto the corresponding direction. If search fails set it to 0.
LEI N Look for a place with equal genoma ID and set regto the corresponding direction. If search fails set it to 0.
LDI N Look for a place with different genoma ID and set regto the corresponding direction. If search fails set it to 0.
LFY N Look for a place with younger entity and set regto the corresponding direction. If search fails set it to 0.
LFO N Look for a place with older entity and set regto the corresponding direction. If search fails set it to 0.
CFN N Check that in the diretion pointed by regthere's a not full, i.e. empty, place. If not set it to 0.
CFF N Check that in the diretion pointed by regthere's a full place. If not set it to 0.
CFD N Check that in the diretion pointed by regthere's a place with different denoma dimension. If not set it to 0.
CFS N Check that in the diretion pointed by regthere's a place with smaller genoma dimension. If not set it to 0.
CFB N Check that in the diretion pointed by regthere's a place with bigger genoma dimension. If not set it to 0.
CFE N Check that in the diretion pointed by regthere's a place with equal genoma dimension. If not set it to 0.
CEI N Check that in the diretion pointed by regthere's a place with equal genoma ID. If not set it to 0.
CDI N Check that in the diretion pointed by regthere's a place with different genoma ID. If not set it to 0.
CFY N Check that in the diretion pointed by regthere's a place with younger entity. If not set it to 0.
CFO N Check that in the diretion pointed by regthere's a place with older entity. If not set it to 0.
RND N Set regto a random value between 0 and 8.
IF0 N Execute the following command only if regis equal 0.
IFN N Execute the following command only if regis not equal 0.
IFE N Execute the following command only if regis equal to mem.
IFD N Execute the following command only if regis not equal to mem.
TRN N If regis not equal 0, set it to the opposite direction.
TRR N If regis not equal 0, set it to the nearest right direction.
TRL N If regis not equal 0, set it to the nearest left direction.
GOF N Go forward in the genoma of regcommands.
GOB N Go backward in the genoma of regcommands.
TO0 N Set regto 0.
TO1 N Set regto 1.
TO2 N Set regto 2.
TO3 N Set regto 3.
TO4 N Set regto 4.
TO5 N Set regto 5.
TO6 N Set regto 6.
TO7 N Set regto 7.
TO8 N Set regto 8.
EOT Y Just end current turn.
SWP N Swap regand memvalues.
WME N Write regvalue into mem.
RME N Write memvalue into reg.
WSI N Write regvalue into current place signal.
RSI N Write current place signalvalue into reg.
VIR Y Try to inoculate current genoma in the diretion pointed by reg(viral attack).
IMM Y Try to react to a viral attack (immunology defense).


Top of page To the top of page.
Simulation Back to Simulation.
Artificial life Back to Artificial Life.
Danilo Poccia - Home Page You can find my home page here.