Which language should I pick if I'm new to coding?
Python
The tutorial builds a robot that finds a target, drives up to it and fires a laser, with its brain written in Python. It takes about 20 minutes, and you do every step yourself.
A Python bot is a loop that runs once a tick:
from bot import Chassis, Scanner, Laser, wait
chassis = Chassis(0)
scanner = Scanner(1)
laser = Laser(2)
while True:
if scanner.ping(0):
b = scanner.bearing(0)
if laser.ready:
laser.fire(b)
wait()
wait() ends the tick: your commands go out, and fresh readings come in.
Blocks
Blocks work like Scratch:
- Everything goes under one when bot starts block. Blocks that aren't attached to it do nothing.
- Each pass of a forever, repeat or repeat until loop takes one tick. You never have to say when to wait.
- You'll find blocks such as drive, turn, point scanner at, scanner sees anything?, laser ready? and log.
- Scanner slots count from 1, as Scratch's lists do.
Under the editor, open Your blocks as Python to see your program written in Python. When you're ready to type, that's a gentle way up to the Python league.
BASIC
Classic line-numbered BASIC: every line starts with a number, and GOTO jumps between lines. You don't set up the parts: statements like DRIVE, TURN, SENSE and FIRE use the standard channels by themselves.
Tips for any language
- In Start from…, pick a house bot in your language to see a complete working bot.
- Open Reference under the editor for every command, with examples.
- Use
log()to print what your bot sees. Logs are free: they cost no cycles and never change a match. - You can always try another language later. Each one is its own league, so you start fresh there.