A multibot
Step by step: a multi-celled organism whose cells are born tied together, share energy, hold their shape and walk as one.
In A tie feeder you used a tie to suck the energy out of another bot, and in A bot that recognizes its own species you learned to tell your own kind apart. Now we go further: instead of using ties, we're going to live in them.
What a multibot is
A multibot (or multicellular) is an organism: several bots joined by ties that share energy and hold themselves in shape. A bot becomes multicellular (.multi is 1) when a tie made with .tie reaches 19 cycles and stiffens, and it happens to both ends at once. The whole tie mechanism (spring, stiffening, ports, sharing) is in Ties and multicellular bots; here we use it to build one from scratch.
The usual recipe is simple: each child ties itself to its parent as soon as it's born, and the organism grows birth by birth. For it to work as an organism and not as a handful of bots hooked together, three things are left to solve: who's in charge, how to share the pantry, and how to walk without falling apart.
Step 1 · Be born tied
Every birth ties the parent to the child with a birth tie. It's a temporary tie: it never stiffens and it breaks by itself after 100 cycles. It also has a quirk: the parent calls it 0, and a 0 is no use for anything, so through that tie the parent can't write to the child or pass it resources; the child, on the other hand, calls it 1 and can.
That's why the recipe goes like this: as soon as it's born, the child ties itself again with .tie, and the new tie overwrites the birth tie. After 19 cycles that tie stiffens and both become multicellular.
And how does a bot know it was born from a parent, so it can tie itself? Through the birth tie: it's already in place in its first cycle of life, so .numties is 1. A founder, a bot seeded on its own, starts with 0. That difference is enough to tell who's who, and we keep it in a free memory cell (Free and epigenetic memory):
def cuerpo 60
' I was born from a parent: I'm body
cond
*.robage 0 =
*.numties 1 =
start
1 .cuerpo store
stop
' just born, I tie myself to the parent with port 7
cond
*.robage 0 =
*.cuerpo 1 =
start
7 .tie store
stop.tie doesn't need to see the parent: if you don't see anyone, in your first cycles the engine tries your parent. The 7 is the port: the name the child will use for that tie; the parent will call it 1, because for the other end the tie is named in order of arrival. And the founder doesn't ask for it: it has no one to tie to, and a failed attempt still charges the tie cost (Tie).
What you should see: seeded alone, nothing yet: the founder doesn't ask for the tie. The observable part comes with the first birth (the reproduction gene comes in the next step): the child is born with .numties 1, in its first cycle it already calls its tie 7, and .multi only becomes 1 in both of them 19 cycles after the tie is made.
Step 2 · Grow: give birth without letting go
An organism that never reproduces never gets past the first generation. Any cell with energy and body to spare can give birth: the child inherits the DNA, appears in front and, as we already know, ties itself.
' with energy and body to spare, I reproduce
cond
*.nrg 3000 >
*.body 500 >
start
30 .repro store
stopTwo details of the birth that work in our favor here. First, the .repro command isn't used up when it fails: if the birth spot is occupied, it's retried cycle after cycle. Second, that spot is in front of the bot, where it's pointing, at the sum of the two radii, and the child is born facing backwards, back to back with the parent. As long as the cells stay close, the newborn child takes up the spot of the next birth and production stalls there: a still organism doesn't raise more than one daughter cell. In step 4, when the ties stretch the cells apart, the spot is free again and the factory starts up again.
What you should see: with a single cell seeded and energy to spare, after a while there are two; the child is born with 30% of the parent's energy and body (minus a thousandth of the transfer that each side pays). And since the child also has the gene from step 1, it ties itself and the organism already has two cells.
Step 3 · A single pantry
In an organism, energy belongs to everyone. With .sharenrg you write what percentage of the total you want to keep with each tie partner; with 50 they end up even. Three conditions, always the same:
- Only the one that created the tie can ask for it; since here the child is the one that ties itself, each cell asks for its share toward its own parent.
- The engine clears the command every cycle, so you have to ask for it every time.
- In one cycle no more energy moves than the body itself (
.body), and whoever asks pays 1% of what was moved.
' as long as I'm multicellular, I share energy evenly
cond
*.multi 1 =
start
50 .sharenrg store
stopWhat you should see: with the parent at 3498 and the child at 1498 (seeded with 5000 energy), as soon as .multi is 1 the two figures converge and stay pinned at ~2493 each: even, minus the 1% for the trip. In longer chains the sharing goes in pairs, but since every cell asks for it, the pantry evens out by itself.
Step 4 · Hold the shape
A tie is a spring: it remembers a rest length and pulls or pushes to get back to it. Once stiffened, it also accepts geometry commands: .fixlen sets the rest length and .fixang sets the angle at which the partner has to end up relative to where you're pointing. With the angle fixed, the tie works like an arm: if the partner drifts out of place, the engine pushes both of them sideways and straightens them.
We ask for a length of 300, edge to edge, and an angle of 314: a quarter turn, so each child ends up at the parent's side and the chain doesn't pile up.
' with the tie stiffened, I give it shape
cond
*.multi 1 =
start
300 .fixlen store
314 .fixang store
stopWhat you should see: the birth leaves the cells almost touching; when the tie stiffens, the request for 300 stretches them: the initial pull goes over 400 and after a few dozen cycles the distance settles near 330. And a happy effect: as the bots stretch apart, the birth spot is free again and the cells give birth again: by ~25 cycles there are already three.
Step 5 · March: the head decides
The last thing is moving, and here it helps to know what the engine does and what it doesn't. Each bot pushes in its own direction with .up; the engine doesn't split your thrust among the tied bots. What does travel through the tie is the spring force: if you move away, it drags your partner along. And with the angle fixed, the torque that corrects the shape pushes both.
So the simplest march is that of real worms: only the head decides. The founder is the only cell that didn't mark cuerpo, so it always pushes; the rest let the spring carry them.
def cuerpo 60
' the head pushes, the body follows
cond
*.cuerpo 0 =
start
10 .up store
stopAnd the whole bot ends up like this:
def cuerpo 60
' I was born from a parent: I'm body
cond
*.robage 0 =
*.numties 1 =
start
1 .cuerpo store
stop
' just born, I tie myself to the parent with port 7
cond
*.robage 0 =
*.cuerpo 1 =
start
7 .tie store
stop
' with energy and body to spare, I reproduce
cond
*.nrg 3000 >
*.body 500 >
start
30 .repro store
stop
' as long as I'm multicellular, I share energy evenly
cond
*.multi 1 =
start
50 .sharenrg store
stop
' with the tie stiffened, I give it shape
cond
*.multi 1 =
start
300 .fixlen store
314 .fixang store
stop
' the head pushes, the body follows
cond
*.cuerpo 0 =
start
10 .up store
stopTo check it, seed several founders and see how they do. What we measured with three, at 100 cycles:
| What we look at | Result |
|---|---|
| Cells per organism | 3 from each founder with room to give birth (one that ended up stuck to the corner of the field got no children: its birth spot fell outside) |
| Ties | The head with 2, the rest with 1, and none broken |
| Relative positions | The length oscillates around the 300 requested (while marching it goes from ~200 to ~430) and the angle holds near the quarter turn: the chain walks without folding up |
| Progress | The organism that walked freely covered ~2500 units in its first 90 cycles; at cruising speed that's about 33 per cycle (a loose bot with the same thrust cruises at ~40): dragging cells costs something, but not much |
| Energy | Even: ~1650 per cell, out of the 5000 at the start |
In the Bestiary
There are real multibots in the Bestiary, with years of tournaments behind them. Peter's Caterpillar walks like a caterpillar: it pins down its head, shortens the tie to 1 with .fixlen to drag the body along, stretches it again to 1000 and repeats; it shares energy, shell and slime by halves (and passes the waste on whole), and when it has gathered too much energy it cuts itself with .deltie so that each section founds a new organism.
Bacillus's Tribolis is a worm with a hierarchy: each cell declares itself head, section or tail in a free cell. All are born declaring themselves head; the one left without ties (the founder, or one that lost them) declares itself tail and reproduces to found the worm; and the head that gathers energy to spare demotes itself to section and gives birth to a new head, so the body grows longer. While marching, the head is in charge: it pushes and fixes its tie at 628, with the body hanging behind; the sections push more slowly so they don't fall behind, and the tail stuns prey with venom.
And Peterb's W6, a tactical multibot with a huge genome: it publishes through the ties where it saw the enemy and builds chains of different sizes depending on how large the population in the field is.
What to try next
- Divide up the jobs. Instead of every cell doing everything, mark them like the Tribolis and go further: some hunt (A bot that shoots) and others photosynthesize (Chloroplasts and vegetables), with energy traveling through the sharing. To choose who does what, the usual route is the tie channels (
.tout1publishes it,.tin1listens) or a cell written by the neighbor with.tienum,.tielocand.tieval. - Change the march. Try having all the cells push: you'll see that the organism covers less ground, because each one pushes toward its own front and it ties itself in a knot (in the test, less than a third of what the head's march achieves). The Caterpillar's inchworm gait (pinning a cell with
.fixposand shortening the tie) does better in tight spaces. - Put it to the test. Challenge the organism with a predator and see what happens if the head falls: the corpse stays tied for a good while (Death and corpses), nobody pushes and the organism is stopped. After that blow, which gene would have to change so that a body cell takes command?
For multibot strategies in competition, see Multibots.