How do I see what my bot's program is doing?
Logging
In Python, JavaScript, Lua, C++ and Java it's log, in C# Log, in BASIC LOG, and in Blocks the log block (assembly has LOG too, with its own format codes). Each {} in the text shows the next value as a number, and {|} shows it as a signal: | if true, . if not. In Python:
log("hull {} scan {|}{|}{|}{|}", chassis.hull, scanner.ping(0), scanner.ping(1), scanner.ping(2), scanner.ping(3))
That writes a line like hull 90 scan |.... The Reference under the editor has the exact form for your language, with examples for every part.
A few things to know:
- A bot logs at most 8 lines a tick; more are dropped. A line over 120 characters is cut short with
…. - Bot logs shows each line with its time in seconds. A line repeated tick after tick shows once, with a count such as
×12. - Each bot's log also lists the damage it takes, for example
−10 ← Scout · hull 90. - The game logs some things for you, such as a sensor that isn't responding.
Log the values your bot decides on: what it sees, where it thinks it is, which state it's in. When it does something odd, scrub the Arena's timeline to that moment and read what it was thinking.
In Brain code
- The status line under the editor says
✓ Compiledwith the ROM and RAM your program uses, or✗and how many errors. Click an error to jump to its line. - Warnings appear in the same list, for example when your code connects a part on a channel where the bot's machine has something else, or nothing.
- Machine (the fold below) lists each part's channel and the line of code that connects to it, and the machine's performance.
- Generated assembly shows the bot-CPU code your program compiled to, and how many lines it is.
- In Blocks, Your blocks as Python shows the same program as Python.