Documentation Index
Fetch the complete documentation index at: https://docs.battlecode.cam/llms.txt
Use this file to discover all available pages before exploring further.
Get started with cambc starter
If you haven’t already, run cambc starter to scaffold your project. When prompted, choose to create the starter bot — it gives you a working bot to build on.
Teams can have at most 50 living units total, including the core. In larger bots, use
c.get_unit_count() with GameConstants.MAX_TEAM_UNITS if you want the exact numbers. c.can_spawn() and any unit-producing c.can_build_*() method already account for the cap.Bot structure
Every bot is a Python file containing aPlayer class with a run method. The engine creates one Player instance per unit and calls run(controller) once per round.
main.py
Key concepts
One Player instance per unit
One Player instance per unit
Each unit (core, builder bot, turret) gets its own
Player instance. Instance variables persist across rounds for that unit, but are not shared between units. Use markers for inter-unit communication.The Controller object
The Controller object
The
controller argument passed to run() provides all game queries and actions. See the full Controller API reference.Imports from cambc
Imports from cambc
from cambc import * gives you all game types: Team, EntityType, Direction, Position, ResourceType, Environment, GameConstants, GameError, and Controller.Time limit
Time limit
Each unit gets 2ms of CPU time per round, plus a 5% buffer that refills when you use less. Locally there are no time limits — use remote test runs to check performance on the actual hardware.
No external packages
No external packages
Only Python standard library modules are available. External packages like
numpy or scipy cannot be imported — bots run in a sandboxed environment with no pip install.Next steps
Run a local match
Test your bot against itself or an example opponent.
Game rules
Understand the full game mechanics before optimising.
API reference
Every method available via the Controller object.
Types and enums
All game types: Team, EntityType, Direction, Position, and more.

