ROBOTWAR
Tick: 0
Instructions
value TO reg | Set a register to a value | 90 TO AIM |
ADD value TO reg | Add value to register | ADD 5 TO AIM |
SUB value TO reg | Subtract value from register | SUB 1 TO SPEED |
MUL value TO reg | Multiply register by value | MUL 2 TO 1 |
DIV value TO reg | Divide register by value | DIV 2 TO 1 |
JUMP label | Go to label unconditionally | JUMP LOOP |
IF v1 op v2 JUMP label | Jump if condition is true ops: = < > # | IF 1 = 0 JUMP MISS |
CALL label | Call subroutine (saves return address) | CALL FIRE |
RETURN | Return from subroutine | |
;LABEL | Define a jump target | ;LOOP |
! text | Comment — ignored by the interpreter | ! fire when locked |
Registers
AIM | Turret angle in degrees (0–359). Wraps automatically. |
SHOT | Set to fire a shell. Value = max range (1–1000). Fires once per tick if heat allows. |
RADAR | Read-only. Returns distance to nearest enemy within ±5° of AIM, or 0 if none. |
SPEED | Movement speed (0–5). Robot moves in HEADING direction each tick. |
HEADING | Direction of movement in degrees (0–359). |
DAMAGE | Read-only. Current damage (0–100). At 100 the robot is destroyed. |
HEAT | Read-only. Firing heat (0–100). Each shot adds 20; decays 2/tick. Can't fire at 100. |
X / Y | Read-only. Current position in the 1000×1000 arena. |
RANDOM | Read-only. Returns a random number 0–359 each time it is read. |
METERS | Total distance traveled. Write 0 to reset the odometer. |
1 – 20 | General-purpose storage registers. Pre-loaded with their own index (reg1=1 … reg20=20). |
Notes
Numbers 1–20 as a source or destination refer to storage registers, not literals.
Use 0 or 21+ for literal values in that range.
Robots start at the four corners. Wall collisions deal 2 damage and stop movement.
Shell hits deal 5 damage. Shells expire at their set range or when they leave the arena.
Robots start at the four corners. Wall collisions deal 2 damage and stop movement.
Shell hits deal 5 damage. Shells expire at their set range or when they leave the arena.