Your first battle
From your first robot to your first win, step by step.

1. Sign in and open My robot
Sign in and open My robot. Each account has one online robot. It starts with ready-made code that moves, turns the radar and shoots when it sees someone:
// Locks the radar on the enemy, aims by turning the body and strafes to dodge.
class Tracker extends Robot {
// The body decides how the robot moves (see Documentation → Bodies and parts):
// legs strafe, wheels race, treads endure, spiders grip the edge.
// Parts: weapon, armor, head and torso. Budget: 12 points.
constructor() {
super({body: "forca", parts: {"weapon": "railgun", "head": "pesquisador.head"}});
this.side = 1;
}
/** @param {State} state */
run() {
while (true) {
const state = this.scan();
const me = state.me;
if (me.charging || me.energy < 20) { this.recharge(); continue; }
const target = state.scanned[0];
// Get away from the lava before anything else.
if (me.distanceToEdge < 8) {
this.turn(me.centerBearing);
this.move(Math.abs(me.centerBearing) < 0.4 ? 5 : 0);
continue;
}
if (target) {
this.turnRadar(target.radarBearing * 2);
// The gun is on the arm: aiming means turning the body.
this.turn(target.bearing);
if (Math.abs(target.bearing) < 0.05 && me.gunHeat === 0) {
this.fire(target.distance < 15 ? 3 : 1.5);
}
// Strafes without losing the aim; switches sides when hit.
if (state.events.some((e) => e.type === "hitByBullet")) this.side = -this.side;
this.strafe(this.side * 4);
if (target.distance < 4.8) this.punch();
} else {
this.turnRadar(1);
this.turn(0.05);
this.move(3);
}
}
}
}// @language typescript
// Types help the editor explain the sensors and commands.
class Strategist extends Robot {
constructor() { super({body: "forca"}); }
private side: number = 1;
run(): void {
while (true) {
const state: State = this.scan();
const me = state.me;
if (me.charging || me.energy < 20) { this.recharge(); continue; }
if (me.distanceToEdge < 8) {
this.turn(me.centerBearing);
this.move(Math.abs(me.centerBearing) < 0.4 ? 5 : 0);
continue;
}
const target = state.scanned[0];
this.turnRadar(target ? target.radarBearing * 2 : 1);
if (target) {
this.turn(target.bearing);
if (Math.abs(target.bearing) < 0.08) this.fire(2);
if (state.events.some(event => event.type === "hitByBullet")) this.side *= -1;
this.strafe(this.side * 4);
if (target.distance < 4.8) this.punch();
} else { this.move(3); }
}
}
}# Wheels: aims, shoots and, while the gun cools down, turns sideways and runs to dodge.
class Dodger(Robot):
# The body decides how the robot moves (see Documentation → Bodies and parts).
# Parts. Budget: 12 points.
def __init__(self):
super().__init__(body="explorador", parts={"weapon": "minigun", "torso": "aranha.torso"})
self.direction = 1
def run(self):
while True:
state = self.scan()
me = state.me
if me.charging or me.energy < 20:
self.recharge()
continue
for e in state.events:
if e.type == "hit_by_bullet":
self.direction *= -1
to_center = me.center_bearing
if me.distance_to_edge < 8:
self.turn(to_center)
self.move(5 if abs(to_center) < 0.4 else 0)
continue
target = state.scanned[0] if state.scanned else None
if not target:
self.turn_radar(1)
self.turn(0.05)
self.move(3)
continue
self.turn_radar(target.radar_bearing * 2)
if me.gun_heat > 0.4:
# Wheels don't strafe: turn sideways to the target and run.
self.turn(self.normalize_angle(target.bearing + self.direction * math.pi / 2))
self.move(6)
else:
# The gun is on the arm: aiming means turning the body.
self.turn(target.bearing)
if abs(target.bearing) < 0.05:
self.fire(1)# Treads: spins the radar, faces the enemy, shoots and punches whoever gets close.
class Spinner < Robot
# The body decides how the robot moves (see Documentation → Bodies and parts).
# Parts. Budget: 12 points.
def initialize
super(parts: {armor: :shield})
end
def run
loop do
state = scan
me = state.me
if me.charging || me.energy < 20
recharge
next
end
to_center = me.center_bearing
if me.distance_to_edge < 8
turn to_center
move(to_center.abs < 0.4 ? 5 : 0)
next
end
target = state.scanned.first
if target
turn_radar target.radar_bearing * 2
# The gun is on the arm: aiming means turning the body.
turn target.bearing
fire 2 if target.bearing.abs < 0.08
punch if target.distance < 4.8
move(target.distance > 12 ? 3 : 0)
else
turn_radar 1.0
turn 0.05
move 3
end
end
end
end-- Lua: list indices start at 1; methods use a colon.
Sentinel = Robot:extend()
function Sentinel:run()
while true do
local state = self:scan()
local me = state.me
if me.charging or me.energy < 20 then
self:recharge()
elseif me.distance_to_edge < 8 then
self:turn(me.center_bearing)
self:move(math.abs(me.center_bearing) < 0.4 and 5 or 0)
else
local target = state.scanned[1]
if target then
self:turn_radar(target.radar_bearing * 2)
self:turn(target.bearing)
if math.abs(target.bearing) < 0.08 then self:fire(2) end
if target.distance < 4.8 then self:punch() end
self:move(target.distance > 12 and 3 or 0)
else
self:turn_radar(1)
self:turn(0.05)
self:move(3)
end
end
end
end2. Test before fighting
In the editor, use Validate code and then Test: the robot runs in a training arena, and you see whether it moves, aims and shoots as you expected. If something fails, the error message tells you the line and the reason.
3. Save
Save code creates a new version of the robot (v1, v2…). Battles use the saved version, never the editor’s draft.
4. Join a battle
In New battle, choose:
- With other players: you create a room and pick the participant limit, the map and the arena. The battle starts by itself when the room is full.
- Against the computer: it starts right away, against one of 5 training robots picked at random. It’s worth up to 2 ranking points.
You can also join another player’s open room from the home page.
5. Watch and improve
When the battle ends, open the replay. See where your robot went wrong: did it stand still with no energy? Fall off the arena? Miss its shots? Change the code, save a new version and try again. The Tutor can analyse the battle and suggest what to change.


