.depth
The bot's vertical position: 0 at the top edge, growing downward, like a depth.
Facts
- Address
- 217
- Names
.depth,.ypos- Kind
- Sense: the engine writes it for the DNA to read
- Group
- Position and surroundings
- Written by
- The engine, in the actions phase of every cycle: the height of the bot's center from the top edge. You read it in the next cycle.
- Cleared
- Nobody; the engine rewrites it every cycle.
- Range
- 0 to 31999; past 32000 it starts over from 0. The settings can divide it by a factor.
- Mutations
- picked as a read (
*)
.depth (also written .ypos) is the vertical coordinate of the bot's center, measured from the top edge of the world and growing downward. That's why it is called depth: in worlds that imitate a pond, the bigger the number, the deeper the bot is. Its partner is .xpos. The engine publishes it at the end of every cycle and in the first cycle of life it is 0.
Like .xpos, past 32000 it starts again from 0, and the configuration can divide it by a factor.
In a pond the light arrives weaker the farther down you go, and chloroplasts yield less (see Chloroplasts and vegetables). A bot can use .depth to avoid sinking; this one goes up when it passes 1000:
cond
*.depth 1000 >
start
314 .setaim store
20 .up store
stopThe 314 points to the top of the screen (see .aim). Since the push is added to the velocity, the bot doesn't stop when it reaches 1000: if the simulation has no friction, it keeps rising to the edge. To stay in a band you have to brake, as shown in .velup.