▚ BATTLE CODE ARENA // BCAS REFERENCE PLAY ▶

BCAS 1.6 · RULESET v0.10

Program a vehicle.
Send it into battle.

In Battle Code Arena you don't drive your vehicle: you write the program that does. This is the reference for that language, Battle Code Arena Script (BCAS): how it works, every function it has, and tutorials that take you from a first program to one that wins.

A whole program
from vehicle import drive, radar, missiles

def update(state, memory):
    contact = radar.contact()

    if contact and state.time - contact.seen_at <= 0.2:
        # Seen it a moment ago: keep the radar on it, aim, and fire.
        radar.scan(contact.bearing)
        missiles.aim(contact.bearing)

        if missiles.ready():
            missiles.fire()
    else:
        # Nothing in sight: sweep the radar round.
        radar.scan(wrap(state.time * 120))

    drive.set(throttle=0.5, turn=0.2)

What BCAS is

A small language that will feel familiar if you've seen Python: indentation for blocks, if, elif and else, numbers, strings and None. It is deliberately small. There are no loops and no functions of your own: your program is one function, update(state, memory), and the game calls it ten times a second for the whole battle. Each time it looks at what the vehicle knows, decides, and gives its orders.

Your vehicle and its opponent run the same rules and the same language. Neither program can see the other's code; both see the same battle.

Where to go next

Always up to date

The function reference, the rules, the equipment and the examples on this site are generated from the game's own core, the same code that runs every battle. Every program in the tutorials is checked by that core before the site is published, so each one will fight as written.