DarwinBotsManual
Open the app EspañolES

What it feels through a tie (tref*)

The sysvars that tell you how the tied bot on the other side of a tie is doing: energy, body, age, position, velocity, signature and one cell of its memory.

AddressSysvarKindSummary
437.trefbodySenseThe body of the tied bot at the other end of the tie you're reading.
438.trefxposSenseThe horizontal coordinate of the tied bot, as it published it the previous cycle.
439.trefyposSenseThe vertical coordinate of the tied bot, as it published it the previous cycle.
440.trefvelmysxSenseThe relative velocity of the tied bot toward your left: it is .trefvelmydx with its sign flipped.
441.trefvelmydxSenseHow much faster than you the tied bot is moving toward your right.
442.trefvelmydnSenseThe relative velocity of the tied bot toward your back: it is .trefvelmyup with its sign flipped.
443.trefvelmyupSenseHow much faster than you the tied bot moves in the direction you are pointing.
444.trefvelscalarSenseThe speed of the tied bot, without direction: a copy of its .velscalar.
445.trefvelyoursxSenseThe leftward sideways velocity of the tied bot, measured from its own front: a copy of its .velsx.
446.trefvelyourdxSenseThe rightward sideways velocity of the tied bot, measured from its own front: a copy of its .veldx.
447.trefvelyourdnSenseThe backward velocity of the tied bot, measured from its own front: a copy of its .veldn.
448.trefvelyourupSenseThe forward velocity of the tied bot, measured from its own front: a copy of its .velup.
449.trefshellSenseThe shell that the tied bot at the other end of the tie has.
456.trefupSenseHow many times the tied bot's DNA writes to .up: part of its signature.
457.trefdnSenseHow many times the tied bot's DNA writes to .dn: part of its signature.
458.trefsxSenseHow many times the tied bot's DNA writes to .sx: part of its signature.
459.trefdxSenseHow many times the tied bot's DNA writes to .dx: part of its signature.
460.trefaimdxSenseHow many times the tied bot's DNA writes to .aimdx: part of its signature.
461.trefaimsxSenseHow many times the tied bot's DNA writes to .aimsx: part of its signature.
462.trefshootSenseHow many times the tied bot's DNA writes to .shoot: part of its signature.
463.trefeyeSenseHow many times the tied bot's DNA reads one of its eyes: the signature count most used to recognize members of your species.
464.trefnrgSenseThe energy of the tied bot at the other end of the tie you're reading.
465.trefageSenseThe age of the tied bot: tells you whether your parent or your child is on the other side.
478.treffixedSenseIt is 1 if the tied bot is fixed in place, 0 if it can move.
479.trefaimSenseWhere the tied bot is pointing: a copy of its .aim.

A tie doesn't just join two bots: it is also a channel through which each one feels the other. The tref* sysvars are to ties what the ref* are to sight: instead of describing what the eye sees, they describe the bot on the other side of a tie, whether or not you can see it.

Which tie is read

A bot can have several ties, but the tref* describe only one at a time: the one with the port you put in .readtie or, if .readtie is 0, the one in .tiepres (the most recently created tie). If there is no tie with that port, or the bot has run out of ties, they all go to 0. Ports are explained in Ties and multicellular bots.

The engine loads them after the DNA runs, so your DNA always reads the snapshot taken in the previous cycle. Two timing details, checked by running it:

What you can know

WhatSysvars
State.trefnrg, .trefbody, .trefage, .trefshell, .treffixed
Where it is and where it points.trefxpos, .trefypos, .trefaim
How it moves, seen from you.trefvelmyup, .trefvelmydn, .trefvelmysx, .trefvelmydx
How it moves, by its own measure.trefvelyourup, .trefvelyourdn, .trefvelyoursx, .trefvelyourdx, .trefvelscalar
Its signature (what its DNA does).trefup, .trefdn, .trefsx, .trefdx, .trefaimdx, .trefaimsx, .trefshoot, .trefeye

In addition, the channels .tin1….tin10 arrive through the same tie, along with any one cell of the other bot's memory via .tmemloc and .tmemval.

The most used in the Bestiary is, by far, .trefeye (compared with .myeye to tell whether the other is of your species); next come .trefnrg, .trefxpos and .trefage (the latter, to tell which is the parent and which is the child). This bot reproduces and the child, as soon as it feels that the tied bot is older than it is, breaks the tie with .deltie:

' Reproduces at 10 cycles
cond
*.robage 10 =
start
50 .repro store
stop

' If the tied bot is older than I am (my parent), I break the tie
cond
*.numties 0 >
*.trefage *.robage >
start
*.tiepres .deltie store
stop

The parent never breaks it: to it, the tied bot is younger. The child breaks it in its fourth cycle, the first one in which it feels its parent.