DarwinBotsManual
Open the app EspañolES

Position and surroundings

Where the bot is in the world, whether it touches the edge, whether it is day and how many bots there are: the senses that locate it.

AddressSysvarKindSummary
214.edgeSenseIt is 1 when the bot is resting against the edge of the world; use it to avoid getting stuck to the wall.
217.depth .yposSenseThe bot's vertical position: 0 at the top edge, growing downward, like a depth.
218.daytimeSenseIt is 1 if it's daytime and 0 if it's night; for a bot with chloroplasts, 1 only if the sun is also shining on it.
219.xposSenseThe bot's horizontal position in the world: 0 at the left edge and growing toward the right.
400.sunSenseIt is 1 when the bot points toward the top of the screen (with about 10 degrees of margin); it has nothing to do with light.
401.totalbotsSenseHow many bots there are in the whole world, counting vegetables, other species and corpses.
402.totalmyspeciesSenseHow many living bots there are of your own species, including the one reading it.

These sysvars tell the bot where it is standing and what the world around it is like. The engine writes all of them; writing to them is pointless, because the engine publishes them again every cycle. And since it publishes them after the DNA runs, in the first cycle of life they are 0.

The most used are .edge, to avoid getting stuck against the wall, and .totalmyspecies, to regulate reproduction: no more children once the species has filled the world. This bot only reproduces while its species has fewer than 50 members:

cond
*.totalmyspecies 50 <
*.nrg 5000 >
start
50 .repro store
stop

Position is useful for staying in a zone (for example, the lit part of a pond, see Chloroplasts and vegetables) or, together with .refxpos and .refypos, for working out which way what it sees is.