DarwinBotsManual
Open the app EspañolES

Tournament bots

How to design a bot that wins F1 league matches: what is really charged, what is worth spending, and the virtues that set the Bestiary's champions apart.

Compete covers the formats, the rules and the Elo; this page is the other half: how to think up a bot that makes the most of them. A match is not a free simulation. Costs are really charged, the dead leave no food, mutations come switched off and the round is won by whoever lasts. Tournament strategy is, before anything else, economics.

A different court, different rules

The world of a match in the F1 league is small and without corners: a 9237 × 6928 field with both axes connected (no walls to hide behind), floor with friction, a maximum speed of 180 and no day or night. Two details that change the whole design:

The pantry is finite too: each round starts with 15 algae of 3000, and repopulation only tops up if they fall below 10, so the energy that enters the world is bounded. With the tournament's default values (5 bots per species, 3000 to start, a cap of 5000 cycles), what decides the round is how you manage yours.

What the league charges, with the multiplier at 1:

ActionPrice
A comparison (even if the gene doesn't fire)0.004
A store0.04
Pushing, per unit0.05
Turningfree
A shot2
A tie attempt2
A new chloroplast0.2
Living one cycle (age + 1000 of body)0.02

Numbers, memory reads and all arithmetic come free, and so does turning: scanning by spinning around costs nothing; what costs is moving, writing and shooting. Measured with these settings: a bot standing still pays 0.02 per cycle, one that pushes flat out (40 of thrust) pays about 2 and runs dry before 1500 cycles, and one that searches in little nudges pays 0.34 and reaches the 5000 cap with energy to spare. Swimming flat out is the most expensive way to find nothing.

The champion's virtues

Efficiency before bravery. I ran a standalone duel between two bots with pedigree, Russia and Teriyaki, on the league field: in 800 cycles they never crossed paths even once (both hunt by waiting), but at that pace one was left with 2750 energy and the other with 580. If the round reaches the cycle cap and is decided on energy, whoever spent less wins. And mind the most treacherous detail in the table: comparisons are charged even if the gene doesn't fire. A DNA with dozens of conditions pays for all of them, every cycle: Russia asleep, doing absolutely nothing, pays 0.31 per cycle, almost all of it on the roughly 65 comparisons in its conditions.

Robustness: don't depend on a single channel. My first searcher had a single eye and a free lesson: when a relative got in front of it, it stayed staring at it forever. It saw something (so it didn't search), but it wasn't food (so it didn't hunt it): stuck, spending without advancing. Tournament bots spread out their gaze: Russia uses eight wide-open eyes for the perimeter and one fine one for aiming, so no distracted relative blocks off its world. The minimal version of the fix is to make “I see nothing or I only see family” count the same.

Social behavior: don't cannibalize. In the league your five starting bots are your team, and a team whose members charge each other loses twice: it loses the energy and it loses bots. The cheapest way to tell your own apart is the signature in .refeye against .myeye (see A bot that recognizes its own species); Russia, Teriyaki and the searcher further down use it. I measured it with three copies of Russia (200 cycles) and two of the searcher (400): zero friendly losses. And there's an extra reason: against a conspecific your venom and your poison do nothing, so biting it is spending for nothing (Defensive bots). The counterexample is Singula, further down: it drains whatever it looks at without asking, and its swarm makes it pay for it.

Knowing how to refuse a fight. The rules reward the one who lasts: the round is won by the last species standing and, at the cycle cap, by the one with the most bots or the most energy. Always fighting is not a strategy: each shot costs you 2, the rival absorbs it or not, and against one that absorbs your blows or wins the exchange, all you're doing is financing your own defeat. Before biting, look at how it's equipped (.refshell, .refpoison, .refvenom): that's what Paranoia does to choose whom to hunt (Defensive bots). And if the exchange doesn't suit you, don't accept it: moving away costs the same as moving closer, and in the duel above, the bot that never fought was ahead.

Three with pedigree, verified

Bestiary names with league wins come cheap: there are real champions and bots that merely call themselves champion. These three run and do what's said here; each run used the league settings and no mutations.

Russia sleeps, Russia charges

Russia (Russia_F1_League_By_Spike43884_11-19-2014.txt, by Spike43884, Russia 2014 league) is a hunter that waits. Its signature is hibernation: when born (on the first cycle all the senses read 0) and whenever it sees nothing and runs short of energy, it shuts down completely and pays 0.31 per cycle; it wakes as soon as a lateral eye sees something. The gene that shuts it down:

def hibernate 51

' I sleep if I see nothing (or if it's family) and am low on energy
cond
 *.eye1 0 =
 *.eye2 0 = and
 *.eye3 0 = and
 *.eye4 0 = and
 *.eye5 0 = and
 *.eye6 0 = and
 *.eye7 0 = and
 *.eye8 0 = and
 *.eye9 0 = and
 *.refeye *.myeye = or
 *.nrg 3000 < and
 *.hibernate 0 = and
start
 1 .hibernate store
stop

When it sees something, it hunts with a fine sight and a wide periphery, standing next to the target and stealing its energy with .shoot at −1. And whoever bites it, it pays back with venom: the sting writes 128 into the turn every cycle, so the thief spends its life spinning in circles instead of going on stealing. Against a lone alga it emptied it in about 20 cycles and went from 3000 to over 6000. Awake and idle, it veers at random (turning is free) and only breeds at 20000: each child is a bet that only pays with a full pantry.

Teriyaki spits and won't be bitten

Teriyaki (Teriyaki_F1_Spike43884_11-05-2014.txt, by Spike43884 with a fix by Shadowgod2) is the opposite: it pays a salary for going around armed. It maintains 500 of poison with a two-line gene:

' Doesn't taste like chicken: poison while it's lacking
cond
 *.poison 500 <
start
 50 .strpoison store
stop

That costs it about 2.9 per cycle (poison loses 2% per cycle, so replenishing 500 is a permanent expense), but whoever bites it gets the blow back poisoned. It attacks mixing −1 and −6: the −6 also takes body, so from a single alga that came in with 3000 and 1000 of body it ended up taking more than 8000. It shoots sperm at rich relatives and breeds sexually; and if it goes over 100 of waste, it relieves itself by shooting it backwards. A complete bot, with a complete bot's price: in the duel with Russia it was the one that ran dry.

Singula Haloculus 2: one gene and a demographic bomb

Singula Haloculus 2 (Singula_Haloculus_2_F1_bacillus_21.04.08.txt, by bacillus, 2008) answers why the simplest one sometimes wins: it is a single gene, always on, and it won leagues all the same. It does three things at once. It breeds without brakes: it asks for a child with more than 200 energy, and in 30 cycles a single copy had become twelve. It keeps its body small, at a third of its energy, with the prettiest line in the Bestiary:

' Body at a third of the energy: surplus, I store; shortfall, I give back
cond
start
 *.nrg 3 div *.body sub dup .strbody store - .fdbody store
stop

And it feeds by tying whatever it's looking at and sucking 1000 per cycle out of it through the tie (.tieloc at −1, .tieval at −1000), without asking what species it is: in a run without food its own swarm drained itself down to four. The cherry on top: its shot is a memory shot, at the address of the other's .shootval, and it leaves −32000 written there. A hunter that charges with −1 and has its .shootval broken kills itself with its own shot: against Singula the tutorial's hunter woke up with its .shootval at −32000 and didn't get far; and a hunter with its .shootval forced to −32000 fell all on its own, with the alga target untouched. No wonder its header says it kills bots that feed by shooting.

Test it before you enter it

Here's a minimal, complete league bot to start from: it searches cheaply, hunts whatever isn't its species, breeds with a full pantry and doesn't eat its siblings.

' Minimal league bot: hunts algae and strangers, doesn't touch its own
cond
 *.robage 0 =
start
 100 .eye5width store
stop

' When I see nothing (or only family): a cheap little nudge
cond
 *.eye5 0 =
 *.refeye *.myeye = or
start
 5 .up store
stop

' I see a stranger: I close in on it
cond
 *.eye5 0 >
 *.refeye *.myeye !=
start
 *.refveldx .dx store
 *.refvelup 30 add .up store
stop

' Accompanied by the target up close: I ask it for energy
cond
 *.eye5 50 >
 *.refeye *.myeye !=
start
 *.refveldx .dx store
 *.refvelup .up store
 -1 .shoot store
stop

' With energy to spare, children
cond
 *.nrg 5000 >
start
 50 .repro store
stop
end

With the league settings it does what it promises: it searches at 0.34 per cycle sweeping the whole field, empties an alga in about 60 cycles and with the gains throws its first child, and two copies together don't cross a single blow in 400 cycles. Against an ordinary hunter of the same style it holds its own: it's numbers and breeding. What it lacks is defenses: against an armed bot it has nothing to say; that's what Defensive bots is for.

For the real tests, in the app:

And remember the fine print of the rulebook: the DNA is frozen when you enter, so enter the version you want to run, not the one you're about to fix.

What to try next