All types are imported from the cambc module:
This gives you: Team, EntityType, ResourceType, Environment, Direction, Position, GameConstants, GameError, and Controller.
Team
class Team(Enum):
A = "a"
B = "b"
EntityType
class EntityType(Enum):
BUILDER_BOT = "builder_bot"
CORE = "core"
GUNNER = "gunner"
SENTINEL = "sentinel"
BREACH = "breach"
LAUNCHER = "launcher"
CONVEYOR = "conveyor"
SPLITTER = "splitter"
ARMOURED_CONVEYOR = "armoured_conveyor"
BRIDGE = "bridge"
HARVESTER = "harvester"
FOUNDRY = "foundry"
ROAD = "road"
BARRIER = "barrier"
MARKER = "marker"
ResourceType
class ResourceType(Enum):
TITANIUM = "titanium"
RAW_AXIONITE = "raw_axionite"
REFINED_AXIONITE = "refined_axionite"
Environment
class Environment(Enum):
EMPTY = "empty"
WALL = "wall"
ORE_TITANIUM = "ore_titanium"
ORE_AXIONITE = "ore_axionite"
Direction
class Direction(Enum):
NORTH = "north"
NORTHEAST = "northeast"
EAST = "east"
SOUTHEAST = "southeast"
SOUTH = "south"
SOUTHWEST = "southwest"
WEST = "west"
NORTHWEST = "northwest"
CENTRE = "centre"
Direction methods
Return the (dx, dy) step for this direction. North is (0, -1), East is (1, 0), etc.
Return the direction rotated 45° counterclockwise.
Return the direction rotated 45° clockwise.
Return the opposite direction (180°).
Position
A named tuple with x and y integer fields.
class Position(NamedTuple):
x: int
y: int
Position methods
Return a new position offset by the direction delta.
Return the squared Euclidean distance to another position.
Return the closest 45° Direction approximation toward other.
Usage
pos = Position(5, 10)
new_pos = pos.add(Direction.NORTH) # Position(5, 9)
dist = pos.distance_squared(new_pos) # 1
dir = pos.direction_to(Position(8, 7)) # Direction.NORTHEAST
GameError
class GameError(Exception):
pass
Raised when a player issues an invalid action (e.g., building on an occupied tile, moving with cooldown > 0).