Movement
The sysvars for pushing the bot, turning it, knowing where it points and how fast it goes, and anchoring it in one place.
| Address | Sysvar | Kind | Summary |
|---|---|---|---|
| 1 | .up | Command | Pushes the bot forward, in the direction it points; you have to write it every cycle in which you want to push. |
| 2 | .dn | Command | Pushes the bot backward, opposite to where it points, without turning it around. |
| 3 | .sx | Command | Pushes the bot sideways to its left, without changing which way it points. |
| 4 | .dx | Command | Pushes the bot sideways to its right, without changing where it points. |
| 5 | .aimdx .aimright | Command | Turns the bot to the right (clockwise) by the amount you write, on a scale where 1256 is a full turn. |
| 6 | .aimsx .aimleft | Command | Turns the bot to the left (counterclockwise) by the amount you write, on a scale where 1256 is a full turn. |
| 11 | .maxvel | Sense | The maximum speed the simulation allows; no bot can go faster. |
| 18 | .aim | Sense | Where the bot is pointing, on a scale of 0 to 1255 where 0 is the right of the screen and 314 is up. |
| 19 | .setaim | Command | Turns the bot to an absolute heading: you write which way you want it to point and the engine puts it there in the same cycle. |
| 196 | .velscalar | Sense | The bot's speed: the size of its velocity, regardless of which direction it is going. |
| 197 | .velsx | Sense | The bot's sideways velocity toward its left: it is .veldx with its sign flipped. |
| 198 | .veldx | Sense | The part of the bot's velocity that goes sideways toward its right; negative if it slides to the left. |
| 199 | .veldn | Sense | The bot's backward velocity: it is .velup with its sign flipped. |
| 200 | .velup .vel | Sense | The part of the bot's velocity that goes forward, in the direction it points; negative if it moves backward. |
| 215 | .fixed | Sense | It is 1 if the bot is anchored in place and 0 if it can move. |
| 216 | .fixpos | Command | Anchors the bot in place while it is greater than 0; with 0 or a negative it releases it. |
A bot does not walk: it pushes itself. The four movement commands, .up, .dn, .sx and .dx, are pushes forward, backward, to the left and to the right, always measured from where the bot points. The engine applies them in the same cycle and sets them to 0, so to keep pushing you have to write them every cycle. Each push is added to the speed it already had: it is an acceleration, not a speed.
There are two ways to turn. .aimsx and .aimdx turn by an amount to the left or the right; .setaim turns to an absolute heading. The current heading is read in .aim. Angles are measured in a unit of their own: a full turn is 1256, so 314 is a quarter turn. 0 looks to the right of the screen, 314 up, 628 to the left and 942 down.
The speed ones report how the bot moved in the last cycle: .velup and .veldn forward and backward, .veldx and .velsx sideways, and .velscalar the total speed. .maxvel gives the cap imposed by the simulation. Finally, .fixpos anchors the bot in place and .fixed reports whether it is anchored.
The most used are .up and .setaim: aim and advance. This bot always advances and, while it is against the edge of the world (reported by .edge), turns a little every cycle until it breaks free:
cond
start
20 .up store
stop
cond
*.edge 0 !=
start
100 .aimsx store
stopThe cost of moving and turning depends on the simulation's configuration (see Execution and costs), and the full physics is in Physics.