What happens when my bot's code has a compile error?
Reading an error
Each error names the line and says what's wrong, usually with a hint for fixing it. Some real examples from the Python league:
| You wrote | The error says |
|---|---|
while True (no colon) | expected :, found the end of the line |
laser.fire(0) without setting up the laser | laser is not defined: create it at the top level, e.g. laser = Laser(2) |
print(1) | the bot has no screen or files: print() isn't available |
x = None | None isn't part of this Python subset: use 0 |
import math | write from bot import Chassis, Scanner, Laser, wait (other modules aren't available) |
The other languages give errors in the same style, in their own words.
In Blocks
There are no line numbers in Blocks. Instead, the error is marked on the block that caused it, and clicking the error takes you to that block. A common one: every program needs a when bot starts block, and only one.
Errors that aren't about one line
Some errors are about the whole program:
- Too big for the ROM: program is 12053 words; this CPU's ROM holds 4096. Make the program smaller, or build the machine with a bigger ROM (ROM-M or ROM-L) in the Factory.
- Too much data for the RAM: shrink your lists or arrays.
- Source too long: a program's source can be up to 64 KiB.
When it compiles
The status line turns to ✓ Compiled (in assembly, ✓ Assembled) and shows how much ROM and RAM your program uses. In any language but assembly, Generated assembly under the editor shows what your program became.
Compiling isn't the same as working
A program that compiles can still do the wrong thing. Test it in the Test arena and add log() lines to see what your bot sees and decides. Logs are free, so leave them in.
A mistake while the bot runs, such as using an index outside a list, doesn't stop the match. The CPU reboots: it stalls for 1 second, then starts your program again from the top.