Agent
Agent functions to interact with the world.
get_round_number
def get_round_number() -> int
Return the current round number.
get_id
def get_id() -> int
Return the id of the agent.
get_type
def get_type() -> AgentType
Return the type of the agent.
get_team
def get_team() -> Team
Return the current team of the agent.
get_location
def get_location() -> Location
Return the current location of the agent.
get_energy_level
def get_energy_level() -> int
Return the current energy level of the agent.
get_lumens
def get_lumens() -> int
None
move
def move(direction: Direction) -> None
Move the agent in the specified direction.
Parameters
Raises
save
def save() -> None
Save a survivor located at the agent's current location.
If no survivor is present, the function has no effect.
Raises
recharge
def recharge() -> None
Recharge the agent's energy if on a charging cell.
Energy restored is equal to Constants.NORMAL_CHARGE
per recharge,
but cannot exceed Constants.MAX_ENERGY_LEVEL
.
Does nothing if the agent is not on a charging cell.
dig
def dig() -> None
Dig rubble at the agent's current location.
Raises
predict
def predict(surv_id: int, label: np.int32) -> None
Submit a prediction.
Parameters
Raises
read_pending_predictions
def read_pending_predictions() -> list[tuple[int, NDArray[np.uint8], NDArray[np.int32]]]
Retrieve the list of pending predictions stored by the agent's team.
Each prediction is represented as a tuple containing:
1. surv_id: The ID of the saved survivor that triggered this prediction.
2. image_to_predict: The symbol image data for model input.
3. all_unique_labels: The set of possible symbol labels.
Return Value
A list of pending symbol predictions. Returns an empty list if no pending predictions are available.
Raises
send_message
def send_message(message: str, dest_ids: list[int]) -> None
Send a message to team members, excluding self.
If dest_ids
is empty, the message is broadcast to all team members
except the sender.
Parameters
read_messages
def read_messages(round_num: int = -1) -> list[Message]
Retrieve messages from the agent's message buffer.
Parameters
Return Value
A list of messages.
drone_scan
def drone_scan(loc: Location) -> None
Scan a location using a drone.
Parameters
Raises
get_cell_info_at
def get_cell_info_at(loc: Location) -> CellInfo
Return the cell info at a given location.
If the location is adjacent (1 tile away) to the agent or has been scanned by a drone,
all layers and agents at that location are visible. Otherwise, only the top layer is
visible and agent presence is hidden.
If HIDDEN_MOVE_COSTS
feature is enabled, unvisited cells have move_cost = 1
.
Parameters
Return Value
A CellInfo object following visibility rules.
spawn_agent
def spawn_agent(loc: Location, agent_type: AgentType) -> None
Spawn an agent at a specified location with a given type.
Parameters
Raises
log
def log(args: object = ()) -> None
Log a message.
Parameters
on_map
def on_map(loc: Location) -> bool
Check whether a location is within the bounds of the world.
Parameters
Return Value
A boolean indicating whetever the given location is on the map.
get_survs
def get_survs() -> list[Location]
Return a list of survivor locations.
get_spawns
def get_spawns() -> list[Location]
Return a list of spawn locations.
get_charging_cells
def get_charging_cells() -> list[Location]
Return a list of charging locations.