esolang

Avida

Tierra with walls and homework. Each digital organism gets its own memory and CPU, and earns speed by computing logic functions.

Charles Ofria, Chris Adami and C. Titus Brown, 1993 · Turing complete: unknown · ●●○ moderate

The idea

Avida is a research platform for digital evolution, started at Caltech in 1993 by Charles Ofria, Chris Adami and C. Titus Brown, and developed for years at Michigan State University. It was inspired by Tierra, with two big changes.

Read the story

First, organisms are isolated. Each has its own protected memory and its own virtual CPU; by default nobody can read or write anyone else's code. That rules out Tierra's parasites and makes experiments cleaner.

Second, organisms can do tasks. The environment hands out 32-bit numbers; an organism that outputs, say, the bitwise NAND of two numbers it read gets more CPU time. The program is still a self-copier first, but now there is something to be good at besides copying.

Its most famous result is a 2003 Nature paper by Lenski, Ofria, Pennock and Adami, "The evolutionary origin of complex features": watching, mutation by mutation, how a complex function (EQU, "are these bits equal") evolves from simpler ones.

The machine

PartWhat it is
GenomeA circular list of instructions from a set of 26
CPUThree registers, two stacks, and heads: instruction, read, write and flow
WorldA grid (3,600 cells in the 2003 paper); a child goes to a neighbouring cell or the parent's, replacing whoever lived there
Energy"SIPs", single-instruction processing units, handed out in proportion to genome length times merit
MeritThe product of the rewards for tasks done in this lifetime, each task counted once
MutationCopy errors (point mutations), plus single insertions and deletions per copied genome

Instructions take no operands. Instead, nop-A, nop-B and nop-C after an instruction modify which register it uses, or act as templates for jumps, as in Tierra. Only one instruction, nand, is a logic operation; every other logic function has to be built out of several of them, plus IO to read inputs and write the output.

The 2003 experiments rewarded nine functions, with rewards growing exponentially with difficulty: NOT and NAND smallest, then AND, OR-NOT, OR, AND-NOT, NOR, XOR, and EQU largest.

Example

The hand-written ancestor of the 2003 paper was 50 instructions: 15 to copy itself and 35 copies of nop-C…

The hand-written ancestor of the 2003 paper was 50 instructions: 15 to copy itself and 35 copies of nop-C as filler. Its copy core looks roughly like this (illustrative, close to Avida's standard "heads" ancestor):

h-alloc            allocate room for the child
h-search nop-C nop-A   find the end-of-genome label; the flow head goes there
mov-head           put the write head at the start of the child
...35 x nop-C...
h-search           mark the top of the copy loop
h-copy             copy one instruction from read head to write head
if-label nop-C nop-A   is the last thing copied the end label?
h-divide           ...then split off the child
mov-head           ...else jump back to the top of the loop
nop-A nop-B        the end label

What the paper found, in its own numbers:

  • Of 50 populations, 23 evolved EQU. When only EQU was rewarded and none of the simpler functions, 0 of 50 did.
  • The first EQU organism in the case study had 60 instructions; knocking out any one of 35 of them destroyed EQU.
  • One step before EQU appeared, a mutation that cut fitness by more than half was a necessary stepping stone: reverting it removed EQU again.

Patterns it teaches

  • Self-replication: an explicit copy loop with read and write heads, one instruction per pass.
  • Artificial life: a lab instrument rather than a toy, with complete genealogies.
  • Open-ended evolution: complexity builds on simpler functions that are themselves rewarded.
  • Every text runs: no operands, so any sequence of the 26 instructions is a valid genome.

Try this

  1. Using only NAND, build NOT, AND and OR. How many NANDs does EQU need? (The paper says five at least.)
  2. Why might isolation make parasites impossible but leave cheaters possible? Think of what an organism can still do to its neighbours in Avida.

Further

  • Lenski, Ofria, Pennock and Adami, "The evolutionary origin of complex features", Nature 423 (2003).
  • Wikipedia: Avida (software)
  • Avida-ED, a teaching version you can run in the browser.

Also in Artificial life