Aegis Logo DarkAegis Docs

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

direction:The direction in which the agent should move.

Raises

AgentError:If the move is invalid.

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

AgentError:If saving is invalid according to game rules.

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

AgentError:If digging is invalid according to game rules.

predict

def predict(surv_id: int, label: np.int32) -> None

Submit a prediction.

Parameters

surv_id:The unique ID of the survivor.
label:The predicted symbol label/classification.

Raises

AgentError:If predictions are not enabled.

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

AgentError:If predictions are not enabled.

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

message:The content of the message to send.
dest_ids:A list of agent IDs to send the message to.

read_messages

def read_messages(round_num: int = -1) -> list[Message]

Retrieve messages from the agent's message buffer.

Parameters

round_num:If provided only messages from this round are returned.

Return Value

A list of messages.

drone_scan

def drone_scan(loc: Location) -> None

Scan a location using a drone.

Parameters

loc:The location to scan.

Raises

AgentError:If drone scan is not enabled or location is invalid.

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

loc:The location to query.

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

loc:A valid spawn location.
agent_type:The type of agent to spawn.

Raises

AgentError:If spawn location is invalid or max amount reached.

log

def log(args: object = ()) -> None

Log a message.

Parameters

*args:One or more items to log.

on_map

def on_map(loc: Location) -> bool

Check whether a location is within the bounds of the world.

Parameters

loc:The location to check.

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.