DarwinBotsManual
Open the app EspañolES

Multibots

Why it pays to be many: what the Bestiary's organisms pay and what they gain, with three championship recipes dissected.

In A multibot you built an organism from scratch: the children tie to the parent, the pantry is shared, the head pushes and the body goes along for the ride. Here we take one step further and read the ones that already came out as champions: the Bestiary holds about 80 bots with “MB” in the name, and in them ties stop being a trick and become a way of life. The full mechanism is in Ties and multicellular bots; the tutorial teaches you to build it; this page teaches you to read someone else's organism the way you read a rival's play.

The bet

Being many costs. Every tie attempt charges the tie cost (Tie), and even the birth tie is charged to the parent at every birth. Sharing isn't free either: you have to ask for it every cycle, whoever asks pays 1% of what moves, and in one cycle no more energy travels than your own body holds (Ties and multicellular bots). And an organism walks slower than a loose bot: it drags along cells that each push toward their own front.

What all that buys:

Caterpillar: the accordion

Peter's Caterpillar lives in pairs: a head and a body joined by a single stiff tie (.stifftie at maximum). It doesn't push with .up: it walks like a wind-up toy caterpillar, folding and stretching.

The head is the clock. Each cell computes the phase from the head's age (the body feels it through the tie with .trefage, the head knows it from its own .robage) and they alternate every seven cycles: in one half, the body anchors and the tie stretches to the maximum, with the head loose; in the other, the head anchors, the tie shortens to 1 and the body drags itself up to it.

def time 100
def head 101
def move 102
def maxlengh 972

' body: high phase of the clock, I anchor and order the tie to stretch
cond
 *.move 1 !=
 *.head 0 =
 *.trefage *.time mod *.time 2 div >
start
 *.maxlengh .fixlen store
 1 .fixpos store
stop

' body: low phase, I let go and accordion: the tie to 1
cond
 *.move 1 !=
 *.head 0 =
 *.trefage *.time mod *.time 2 div <
start
 1 .fixlen store
 0 .fixpos store
stop

The sharing has a lock. Every living Caterpillar increments a public counter every cycle (.tout1), so the age I feel in the other one has to match the counter that reaches me (.tin1): if the tied bot is a corpse (which no longer increments) or a stranger, it shares nothing.

def stiftie 973

' I only share if the tied bot is a living Caterpillar
cond
 *.numties 1 =
 *.trefage *.tin1 =
start
 .tienum inc
 *.stiftie .stifftie store
 50 .sharenrg store
 50 .shareshell store
 50 .shareslime store
 100 .sharewaste store
 *.tiepres .readtie store
stop

When it hunts, it aims with .setaim and picks the shot according to the victim's defense: body (-6) against those that rely on poison, energy (-1) against those that rely on shell (Shots). And it carries a liftoff gene: with more than 5000 energy and 2000 body, it cuts the tie with .deltie; each half is left alone, and a lone cell gives birth to a new head. In our runs without food it never got that far, but in a world that feeds it, this is how it multiplies.

One detail worth stealing: it keeps its configuration (the maximum length, the stiffness) in the instant genetic memory cells, so every offspring is born with the same values without writing them again (Free and epigenetic memory).

Tribolis: the worm with jobs

Bacillus's Tribolis is a worm with a hierarchy. Each cell declares itself in one of its memory cells: 1 head, 2 segment, 3 tail. All are born as heads; the one left without ties demotes itself to tail and gives birth; and a head that gathers energy to spare demotes itself to segment and gives birth to a new head, so the worm grows from the front. Here it is dissected in its version 1.0 (Tribolisv1.0_F2MB_Bacillus_51008.txt); the one in the tutorial A multibot is 0.1 (Tribolis_0.1_MB_Bacillus_-21008.txt), an earlier sketch of the same design.

def type 999
def head 1
def middle 2
def tail 3

' born: I tie to the parent, publish the signature and declare myself head
cond
 *.robage 0 =
start
 2 .tie store
 654 .out1 store
 .head .type store
 654 .tout1 store
stop

' lone cell with energy: I demote myself to tail and found the worm
cond
 *.numties 0 =
 *.nrg 2000 >
 *.eye5 40 <
start
 .tail .type store
 60 .repro store
stop

Each job has its own genes. The head pushes flat out (in the run, .velup stayed pinned at 40, the speed cap, Max speed) and takes the tie to 628 with .fixang, the body hanging behind. The segments push more slowly so they don't lose the chain, and they dump waste. And the tail is the one that handles the prey: it doesn't kill it, it steers it.

def type 999
def tail 3

' tail: I write a 1 into its .fixpos and the prey is left anchored
cond
 *.type .tail =
 *.in1 *.out1 !=
 *.eye5 30 >
 *.reffixed 0 =
start
 .shootval inc
 .fixpos .shoot store
stop

' tail: if the prey is paralyzed, I make it spin
cond
 *.type .tail =
 *.in1 *.out1 !=
 *.memval 0 >
 *.eye5 30 >
start
 *.refxpos *.refypos angle 628 add .shootval store
 .setaim .shoot store
stop

The trick is the memory shot: .shoot with a positive value writes your .shootval into that cell of the target (Shots). The tail writes into the prey's .fixpos (it's left anchored) and even into its .setaim (it turns it half a turn). Between that and its venom, the prey arrives docile at the head's mouth.

Defense belongs to the whole organism too: each cell publishes through the tie how much shell and poison it is maintaining, and adopts its neighbor's level if it's higher. If one cell gets shot, the whole worm armors up.

And if the worm breaks, it isn't lost: each piece keeps walking and the one left alone founds again. In our runs, a worm that was cut gave two new organisms, each with its own tail and head.

Inchworm: the head drives by remote control

Purple Youko's Inchworm is the minimalist: a head and a tail, nothing more. Its charm is how the head talks to the tail. The step lasts ten cycles, marked by a counter: at one count, the head anchors and orders the tail to let go; at another, it lets go itself and writes “stay still” directly into the tail's .fixpos cell, through the tie. Then it shortens the tie to 120 (the tail drags itself up to the anchored head) and stretches it to 360 (the head is pushed out, with the tail as an anchor).

def type 50
def counter 51
def fix 54

' head, counter 1: I anchor myself and order the tail to let go
cond
 *.type 1 =
 *.counter 1 =
start
 1 .fixpos store
 1 .tienum store
 2 .tieval store
 .fix .tieloc store
stop

' head, counter 6: I let go and write stay-still into it
cond
 *.type 1 =
 *.counter 6 =
start
 0 .fixpos store
 1 .tienum store
 1 .tieval store
 .fixpos .tieloc store
stop

Note the difference between the two orders. The first writes into a data cell of the tail (its fix), and the tail reacts with genes of its own. The second goes straight in: writing into its .fixpos is writing it an order, and the engine carries it out on its turn. The write travels in the forces and collisions phase, so today's order is obeyed tomorrow (Ties and multicellular bots). Measured: the tail's .fixpos changes exactly when the head's counter says so.

It's slow (in the run, barely a couple of units per cycle) but it never falls apart: each step anchors one of the two first, so the organism is never left loose.

A design tip

From these runs I'd keep two ways of synchronizing a gait. If the choreography is periodic, don't send orders: share a clock. Caterpillar doesn't order the body to do anything: both cells read the head's age (one through the tie, the other from its own memory) and each works out its own step; there's no message that can get lost. And if the order is a one-off, don't publish it and wait: write it into the other one's memory with .tienum, .tieloc and .tieval, like Inchworm with its remote .fixpos. Publishing to .tout8 and having the other one read .tin8 requires the other one to have the gene that listens; direct writing doesn't.

The opportunists

Not every “MB” lives in organisms. Peterb's W6 (an enormous genome full of tactics) ties when it suits it and cuts loose when it doesn't: it publishes through the ties where it saw the enemy and builds chains depending on how much population there is. In our runs it never got past passing pairs: a tie, a while of .multi 1 and on to something else. The organism, for it, is just one more tactic, not an identity. Seed it dense and sparse and you'll see the difference.

What to try next