LeverLabs

Square Genes, a Life Simulator

written by Onne Gorter on 2016/07/14

Below is an artificial life simulator. It has rules about space, energy and gene expressions. But it has no rules about fitness or survival.

Some lucky genes happen to copy before its nucleus ages and dies. But it will need energy to do so, or die of starvation. Only those that make it, can populate this virtual world.

It is an experiment following my previous post on bottom up design verifying that where self-copying is possible, when it appears, it will self-select and evolve.

What are you seeing? Yellow is a nucleus with a set of genes. Green is a part that can harvest energy from the environment, but slowly. Red can eat green and yellow as food. Blue can eat Red.

When there are empty areas, the simulator will spawn nuclei with random genes and a bit of energy. It usually takes around 50.000 spawns for the first viable gene to appear. But the simulation is fast enough to enjoy the spectacle that follows.

You can click a square and see its genes and how they express.

The Genetic Code

The genes instruct the entity what to do. Genes can instruct to build a part. Or to create a seedling nucleus with a certain level of mutation. Or point at where to build parts. Or check certain signals and decide to express or not.

The genetic code is a list of pairs, a command and a level. A gene starts and ends with a begin code (-).

The conditionals negate if the level is 4 or larger.

The simulation as shown here is somewhat small, to conserve CPU and work on mobile. You can run a much larger version or check out the source on github.

Submit to Hacker News