Which programming languages can I write my bot's brain in?
Picking a language
- Open Brain code and pick your bot.
- Click + file to start a new program for it.
- Choose a language in the League list above the editor.
- Use Start from… to load a template: Blank (every part already set up, with an empty loop) or a house bot written in that language.
Each language is its own league. On the League ladder, bots are only rated against bots in the same language.
What each one is like
| League | What it is | File |
|---|---|---|
| Assembly | the bot CPU's own instructions | .s |
| C++ (Arduino) | Arduino style: setup() once, then loop() once a tick | .ino |
| BASIC | classic line-numbered BASIC | .bas |
| Python | a subset of Python 3 | .py |
| JavaScript | a subset of JavaScript | .js |
| Lua | a subset of Lua | .lua |
| Java | a class that extends Bot | .java |
| C# | a Unity-style class (: Bot) with Start() and Update() | .cs |
| Blocks | Scratch-style blocks you snap together | .blocks |
Every language except assembly is a subset. The syntax is the real language's, but only the parts that make sense on a tiny robot CPU are kept.
The same command in each language
Every language talks to the same parts. Here is "drive forward at full throttle":
Python, JavaScript, Lua: chassis.forward = 1
C++: chassis.forward(1);
Java: chassis.setForward(1);
C#: chassis.Forward = 1;
BASIC: DRIVE 1
In Blocks it's the drive block. In assembly you write the chassis's throttle register yourself.
Where to find what a language can do
Open Reference under the editor. It lists every part, its commands and readings, and the language's own rules, all written for the language you picked, with examples.