thebotslam

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 wroteThe error says
while True (no colon)expected :, found the end of the line
laser.fire(0) without setting up the laserlaser 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 = NoneNone isn't part of this Python subset: use 0
import mathwrite 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:

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.