.maxvel
The maximum speed the simulation allows; no bot can go faster.
Facts
- Address
- 11
- Name
.maxvel- Kind
- Sense: the engine writes it for the DNA to read
- Group
- Movement
- Written by
- The engine, in the movement phase of every cycle: the speed cap from the settings. You read it in the next cycle.
- Cleared
- Nobody; the engine rewrites it every cycle. Writing to it changes nothing.
- Range
- That of Max speed; 40 by default. It is 0 in the first cycle of life.
- Mutations
- picked as a read (
*)
.maxvel reports the simulation's speed limit. It is a fact about the world, the same for all bots: it is set by the configuration (Max speed; 40 by default) and the engine publishes it every cycle. Writing to it changes nothing.
That cap acts twice. No bot can go faster than .maxvel (.velscalar never exceeds it), and the push of one cycle, after being multiplied by the mass, is also clipped to that value. That is why pushing with .up much harder than .maxvel is wasteful.
Since the engine publishes it at the end of the cycle, in the bot's first cycle of life it is 0.
A reasonable use is to push only while there is still speed to gain:
' accelerates up to the cap and then stops pushing
cond
*.velup *.maxvel <
start
*.maxvel *.velup sub .up store
stop