Swarm Genetic Programming

Every creature in the swarm runs the same small assembly program. A genetic algorithm (written in Rust, running as WebAssembly) evolves that program until the swarm gets through an obstacle course. A program counts as verified when it also works on 8 held-out seeds, and verified programs collect in a library.

Course

Swarm

creature other program problem solved gate food exit marks
Click a creature to see its registers.

Try a program runs on the current course

How it works

A creature fills one cell of a 16-bit grid and has 16 integer registers $0..$15 that persist between ticks. Each tick it runs the program from the top (at most 200 instructions, at most one move). Arithmetic is LODA-style: mov add sub mul div mod min max.

f21 $0,$4 calls a registry function with 2 inputs and 1 output. The id of the function is the value of $4, its inputs are $5,$6, and the output goes to $0. So a program can compute which function it calls.

There is exactly one loop: lpb $c … lpe runs its body $c times. The count is read once when the loop starts (clamped to 0..255), so every program ends. There is no goto. Conditions come from arithmetic: a count of 0 or 1 is an if.

Problem stations hold a polynomial a0 + a1·x + a2·x² + a3·x³. Any creature next to the station can read it, and each creature gets one guess. A right answer opens the station's gates for the whole swarm.

Evolution not verified

generation
0
programs tried
0
best fitness
–
swarm out
–
Best fitness per generation. 1000 points for the whole swarm out, plus credit for solved problems, progress, food and close answers.

Best program


    

Library

No verified programs yet.

Function registry