bot_api.events package¶
Submodules¶
bot_api.events.bot_death_event module¶
- class BotDeathEvent(turn_number: int, victim_id: int)[source]¶
Bases:
BotEventEvent occurring when another bot has died.
- Variables:
victim_id (int) – The ID of the bot that has died.
- victim_id: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.bot_event module¶
- class BotEvent(turn_number: int)[source]¶
Bases:
EventABCRepresents any event related to a bot during a battle. This class serves as the parent for all bot-related events and provides default implementations for common bot event methods.
- Variables:
turn_number (int) – The turn number when this event occurred.
- turn_number: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
bot_api.events.bullet_fired_event module¶
- class BulletFiredEvent(turn_number: int, bullet: BulletState)[source]¶
Bases:
BotEventRepresents an event that occurs when a bullet is fired from a bot.
This event contains information about the bullet that was fired and the turn number during which the event occurred.
- Variables:
bullet (BulletState) – The state of the bullet that was fired.
- bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.bullet_hit_bot_event module¶
- class BulletHitBotEvent(turn_number: int, victim_id: int, bullet: BulletState, damage: float, energy: float)[source]¶
Bases:
BotEventRepresents an event triggered when a bullet hits a bot.
- Variables:
victim_id (int) – The ID of the bot that was hit.
bullet (BulletState) – The bullet that hit the bot.
damage (float) – The damage caused by the bullet.
energy (float) – The remaining energy of the bot that was hit. Starts at 100.0 (fully operational) and decreases with damage. Energy 0.0 represents a disabled bot. Negative energy indicates the bot is dead (e.g., -1 for a dead bot).
- victim_id: int¶
- bullet: BulletState¶
- damage: float¶
- energy: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.bullet_hit_bullet_event module¶
- class BulletHitBulletEvent(turn_number: int, bullet: BulletState, hit_bullet: BulletState)[source]¶
Bases:
BotEventEvent triggered when a bullet collides with another bullet in the arena.
- Variables:
bullet (BulletState) – The bullet that collided with another bullet.
hit_bullet (BulletState) – The bullet that was hit during the collision.
- bullet: BulletState¶
- hit_bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.bullet_hit_wall_event module¶
- class BulletHitWallEvent(turn_number: int, bullet: BulletState)[source]¶
Bases:
BotEventRepresents an event that occurs when a bullet hits a wall during a game.
This event provides information about which bullet hit the wall and at what turn the event occurred.
- Variables:
bullet (BulletState) – The bullet that hit the wall.
- bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.condition module¶
- class Condition(name: str | None = None, callable: Callable[[], bool] | None = None)[source]¶
Bases:
objectA class used to test whether a specific condition is met.
This class can be utilized in multiple ways:
To block program execution by using methods like IBot.wait_for, which halts until a condition is satisfied.
To trigger a custom event by adding a handler using IBaseBot.add_custom_event. When the condition is fulfilled, the IBaseBot.on_custom_event method is triggered.
Example 1: Using a Condition subclass
- class MyBot(Bot):
- def run(self):
- while self.is_running():
# … self.set_turn_right(90) self.wait_for(TurnCompleteCondition(self)) # …
- class TurnCompleteCondition(Condition):
- def __init__(self, bot: Bot):
self.bot = bot
- def test(self) -> bool:
return self.bot.turn_remaining == 0
Example 2: Using a lambda expression
- class MyBot(Bot):
- def run(self):
- while self.is_running():
# … self.set_turn_right(90) self.wait_for(lambda: self.turn_remaining == 0) # …
- Variables:
name (Optional[str]) – The name of the condition (optional). This is useful for identifying the condition in custom events handled by IBaseBot.on_custom_event.
callable (Optional[Callable[[], bool]]) – A callable (e.g., lambda or function) that returns True if the condition is met, and False otherwise.
- name: str | None = None¶
- callable: Callable[[], bool] | None = None¶
- test() bool[source]¶
Evaluates whether the condition is met.
This method should be overridden in subclasses to implement custom condition logic. Alternatively, a callable can be provided during initialization to evaluate the condition.
- Returns:
True if the condition is met; False otherwise.
- Return type:
bool
Note
If a callable is provided and raises an exception during execution, the method will return False.
bot_api.events.connected_event module¶
- class ConnectedEvent(server_uri: str)[source]¶
Bases:
ConnectionEventEvent occurring when bot gets connected to server
- server_uri: str¶
bot_api.events.connection_error_event module¶
- class ConnectionErrorEvent(server_uri: str, error: Exception | None = None)[source]¶
Bases:
ConnectionEventRepresents an event that occurs when a connection error happens.
- Variables:
error (Exception) – The exception representing the connection error.
- error: Exception | None = None¶
- server_uri: str¶
bot_api.events.connection_event module¶
bot_api.events.custom_event module¶
- class CustomEvent(turn_number: int, condition: Condition)[source]¶
Bases:
BotEventRepresents a custom event triggered when a specific condition is satisfied.
- Variables:
condition (Condition) – The condition that was satisfied to trigger this event.
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.death_event module¶
- class DeathEvent(turn_number: int)[source]¶
Bases:
BotEventRepresents an event triggered when the bot has died.
- property critical: bool¶
Overrides the default implementation to mark this event as critical. :returns: Always returns True since a death event is critical. :rtype: bool
- turn_number: int¶
bot_api.events.disconnected_event module¶
- class DisconnectedEvent(server_uri: str, remote: bool, status_code: int | None = None, reason: str | None = None)[source]¶
Bases:
ConnectionEventRepresents an event triggered when the bot gets disconnected from the server.
- Variables:
remote (bool) – Indicates whether the disconnection was initiated by the remote host.
status_code (Optional[int]) – The status code indicating the reason for the disconnection, if available.
reason (Optional[str]) – A textual description of the reason for the disconnection, if provided.
- remote: bool¶
- status_code: int | None = None¶
- reason: str | None = None¶
- server_uri: str¶
bot_api.events.event_abc module¶
bot_api.events.game_ended_event module¶
- class GameEndedEvent[source]¶
Bases:
EventABCEvent triggered when the game ends.
- Variables:
number_of_rounds (int) – The total number of rounds played in the game.
results (BotResults) – The results of the battle for this bot, containing detailed scores and performance metrics.
- number_of_rounds: int¶
- results: BotResults¶
bot_api.events.game_started_event module¶
- class GameStartedEvent(my_id: int, initial_position: InitialPosition, game_setup: GameSetup)[source]¶
Bases:
EventABCRepresents an event triggered when the game starts.
- Variables:
my_id (int) – The unique identifier for your bot in the current battle.
initial_position (InitialPosition) – The starting position of the bot.
game_setup (GameSetup) – The configuration details for the game that has just started.
- my_id: int¶
- initial_position: InitialPosition¶
bot_api.events.hit_bot_event module¶
- class HitBotEvent(turn_number: int, victim_id: int, energy: float, x: float, y: float, rammed: bool)[source]¶
Bases:
BotEventRepresents an event triggered when the bot collides with another bot.
- Variables:
victim_id (int) – The ID of the bot that your bot collided with.
energy (float) – The remaining energy level of the victim bot.
x (float) – The X coordinate of the victim bot at the time of collision.
y (float) – The Y coordinate of the victim bot at the time of collision.
rammed (bool) – Whether the collision was caused by ramming.
- victim_id: int¶
- energy: float¶
- x: float¶
- y: float¶
- rammed: bool¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.hit_by_bullet_event module¶
- class HitByBulletEvent(turn_number: int, bullet: BulletState, damage: float, energy: float)[source]¶
Bases:
BotEventRepresents an event when a bot is hit by a bullet.
This event is triggered when a bullet hits the bot during a turn in the game. It provides information about the bullet, the damage caused, and the bot’s remaining energy after the hit.
- Variables:
bullet (BulletState) – The bullet that hit the bot.
damage (float) – The damage inflicted on the bot by the bullet.
energy (float) – The bot’s remaining energy after being hit.
- bullet: BulletState¶
- damage: float¶
- energy: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.hit_wall_event module¶
- class HitWallEvent(turn_number: int)[source]¶
Bases:
BotEventEvent occurring when your bot has hit a wall.
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.round_ended_event module¶
- class RoundEndedEvent(round_number: int, turn_number: int, results: BotResults)[source]¶
Bases:
EventABCRepresents an event triggered when a round has ended in Robocode.
- Variables:
round_number (int) – The number of the round that just ended.
turn_number (int) – The final turn number of the round.
results (BotResults) – The accumulated results of all bots at the end of the round.
- round_number: int¶
- turn_number: int¶
- results: BotResults¶
bot_api.events.round_started_event module¶
bot_api.events.scanned_bot_event module¶
- class ScannedBotEvent(turn_number: int, scanned_by_bot_id: int, scanned_bot_id: int, energy: float, x: float, y: float, direction: float, speed: float)[source]¶
Bases:
BotEventEvent triggered when a bot scans another bot.
- Variables:
scanned_by_bot_id (int) – The ID of the bot that performed the scanning.
scanned_bot_id (int) – The ID of the bot that was scanned.
energy (float) – The energy level of the scanned bot.
x (float) – The X-coordinate of the scanned bot.
y (float) – The Y-coordinate of the scanned bot.
direction (float) – The direction (in degrees) of the scanned bot.
speed (float) – The speed (in units per turn) of the scanned bot.
- scanned_by_bot_id: int¶
- scanned_bot_id: int¶
- energy: float¶
- x: float¶
- y: float¶
- direction: float¶
- speed: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.skipped_turn_event module¶
- class SkippedTurnEvent(turn_number: int)[source]¶
Bases:
BotEventRepresents an event triggered when the bot has skipped a turn.
This event occurs when the bot fails to take its turn within the allotted time frame.
- property critical: bool¶
Indicates whether this event is critical.
- Returns:
Always returns True, as skipping a turn is considered a critical event.
- Return type:
bool
- turn_number: int¶
bot_api.events.team_message_event module¶
- class TeamMessageEvent(turn_number: int, message: Any, sender_id: int)[source]¶
Bases:
BotEventRepresents an event triggered when a bot has received a message from a teammate during a specific turn.
- Variables:
message (Any) – The message sent by the teammate. Cannot be None.
sender_id (int) – The unique ID of the teammate who sent the message.
- message: Any¶
- sender_id: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.tick_event module¶
- class TickEvent(turn_number: int, round_number: int, bot_state: BotState | None, bullet_states: Sequence[BulletState | None] | None, events: Sequence[BotEvent])[source]¶
Bases:
BotEventRepresents an event that occurs at the start of a new turn within a round.
- Variables:
round_number (int) – The current round number in the battle.
bot_state (BotState) – The current state of the bot.
bullet_states (list[BulletState]) – A list containing the states of bullets fired by the bot.
events (list[BotEvent]) – A list of events that occurred in this turn.
- round_number: int¶
- bullet_states: Sequence[BulletState | None] | None¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
bot_api.events.won_round_event module¶
Module contents¶
- class BotEvent(turn_number: int)[source]¶
Bases:
EventABCRepresents any event related to a bot during a battle. This class serves as the parent for all bot-related events and provides default implementations for common bot event methods.
- Variables:
turn_number (int) – The turn number when this event occurred.
- turn_number: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- class BotDeathEvent(turn_number: int, victim_id: int)[source]¶
Bases:
BotEventEvent occurring when another bot has died.
- Variables:
victim_id (int) – The ID of the bot that has died.
- victim_id: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class BulletFiredEvent(turn_number: int, bullet: BulletState)[source]¶
Bases:
BotEventRepresents an event that occurs when a bullet is fired from a bot.
This event contains information about the bullet that was fired and the turn number during which the event occurred.
- Variables:
bullet (BulletState) – The state of the bullet that was fired.
- bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class BulletHitBotEvent(turn_number: int, victim_id: int, bullet: BulletState, damage: float, energy: float)[source]¶
Bases:
BotEventRepresents an event triggered when a bullet hits a bot.
- Variables:
victim_id (int) – The ID of the bot that was hit.
bullet (BulletState) – The bullet that hit the bot.
damage (float) – The damage caused by the bullet.
energy (float) – The remaining energy of the bot that was hit. Starts at 100.0 (fully operational) and decreases with damage. Energy 0.0 represents a disabled bot. Negative energy indicates the bot is dead (e.g., -1 for a dead bot).
- victim_id: int¶
- bullet: BulletState¶
- damage: float¶
- energy: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class BulletHitBulletEvent(turn_number: int, bullet: BulletState, hit_bullet: BulletState)[source]¶
Bases:
BotEventEvent triggered when a bullet collides with another bullet in the arena.
- Variables:
bullet (BulletState) – The bullet that collided with another bullet.
hit_bullet (BulletState) – The bullet that was hit during the collision.
- bullet: BulletState¶
- hit_bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class BulletHitWallEvent(turn_number: int, bullet: BulletState)[source]¶
Bases:
BotEventRepresents an event that occurs when a bullet hits a wall during a game.
This event provides information about which bullet hit the wall and at what turn the event occurred.
- Variables:
bullet (BulletState) – The bullet that hit the wall.
- bullet: BulletState¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class Condition(name: str | None = None, callable: Callable[[], bool] | None = None)[source]¶
Bases:
objectA class used to test whether a specific condition is met.
This class can be utilized in multiple ways:
To block program execution by using methods like IBot.wait_for, which halts until a condition is satisfied.
To trigger a custom event by adding a handler using IBaseBot.add_custom_event. When the condition is fulfilled, the IBaseBot.on_custom_event method is triggered.
Example 1: Using a Condition subclass
- class MyBot(Bot):
- def run(self):
- while self.is_running():
# … self.set_turn_right(90) self.wait_for(TurnCompleteCondition(self)) # …
- class TurnCompleteCondition(Condition):
- def __init__(self, bot: Bot):
self.bot = bot
- def test(self) -> bool:
return self.bot.turn_remaining == 0
Example 2: Using a lambda expression
- class MyBot(Bot):
- def run(self):
- while self.is_running():
# … self.set_turn_right(90) self.wait_for(lambda: self.turn_remaining == 0) # …
- Variables:
name (Optional[str]) – The name of the condition (optional). This is useful for identifying the condition in custom events handled by IBaseBot.on_custom_event.
callable (Optional[Callable[[], bool]]) – A callable (e.g., lambda or function) that returns True if the condition is met, and False otherwise.
- name: str | None = None¶
- callable: Callable[[], bool] | None = None¶
- test() bool[source]¶
Evaluates whether the condition is met.
This method should be overridden in subclasses to implement custom condition logic. Alternatively, a callable can be provided during initialization to evaluate the condition.
- Returns:
True if the condition is met; False otherwise.
- Return type:
bool
Note
If a callable is provided and raises an exception during execution, the method will return False.
- class ConnectedEvent(server_uri: str)[source]¶
Bases:
ConnectionEventEvent occurring when bot gets connected to server
- server_uri: str¶
- class ConnectionErrorEvent(server_uri: str, error: Exception | None = None)[source]¶
Bases:
ConnectionEventRepresents an event that occurs when a connection error happens.
- Variables:
error (Exception) – The exception representing the connection error.
- error: Exception | None = None¶
- server_uri: str¶
- class ConnectionEvent(server_uri: str)[source]¶
Bases:
EventABCRepresents the base class for connection-related events.
- Variables:
server_uri (str) – The URI of the server associated with the connection event.
- server_uri: str¶
- class CustomEvent(turn_number: int, condition: Condition)[source]¶
Bases:
BotEventRepresents a custom event triggered when a specific condition is satisfied.
- Variables:
condition (Condition) – The condition that was satisfied to trigger this event.
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class DeathEvent(turn_number: int)[source]¶
Bases:
BotEventRepresents an event triggered when the bot has died.
- property critical: bool¶
Overrides the default implementation to mark this event as critical. :returns: Always returns True since a death event is critical. :rtype: bool
- turn_number: int¶
- class DisconnectedEvent(server_uri: str, remote: bool, status_code: int | None = None, reason: str | None = None)[source]¶
Bases:
ConnectionEventRepresents an event triggered when the bot gets disconnected from the server.
- Variables:
remote (bool) – Indicates whether the disconnection was initiated by the remote host.
status_code (Optional[int]) – The status code indicating the reason for the disconnection, if available.
reason (Optional[str]) – A textual description of the reason for the disconnection, if provided.
- remote: bool¶
- status_code: int | None = None¶
- reason: str | None = None¶
- server_uri: str¶
- class EventABC[source]¶
Bases:
ABCAbstract base class for all event types. Provides a shared type for identifying all events.
- class GameEndedEvent[source]¶
Bases:
EventABCEvent triggered when the game ends.
- Variables:
number_of_rounds (int) – The total number of rounds played in the game.
results (BotResults) – The results of the battle for this bot, containing detailed scores and performance metrics.
- number_of_rounds: int¶
- results: BotResults¶
- class GameStartedEvent(my_id: int, initial_position: InitialPosition, game_setup: GameSetup)[source]¶
Bases:
EventABCRepresents an event triggered when the game starts.
- Variables:
my_id (int) – The unique identifier for your bot in the current battle.
initial_position (InitialPosition) – The starting position of the bot.
game_setup (GameSetup) – The configuration details for the game that has just started.
- my_id: int¶
- initial_position: InitialPosition¶
- class HitBotEvent(turn_number: int, victim_id: int, energy: float, x: float, y: float, rammed: bool)[source]¶
Bases:
BotEventRepresents an event triggered when the bot collides with another bot.
- Variables:
victim_id (int) – The ID of the bot that your bot collided with.
energy (float) – The remaining energy level of the victim bot.
x (float) – The X coordinate of the victim bot at the time of collision.
y (float) – The Y coordinate of the victim bot at the time of collision.
rammed (bool) – Whether the collision was caused by ramming.
- victim_id: int¶
- energy: float¶
- x: float¶
- y: float¶
- rammed: bool¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class HitByBulletEvent(turn_number: int, bullet: BulletState, damage: float, energy: float)[source]¶
Bases:
BotEventRepresents an event when a bot is hit by a bullet.
This event is triggered when a bullet hits the bot during a turn in the game. It provides information about the bullet, the damage caused, and the bot’s remaining energy after the hit.
- Variables:
bullet (BulletState) – The bullet that hit the bot.
damage (float) – The damage inflicted on the bot by the bullet.
energy (float) – The bot’s remaining energy after being hit.
- bullet: BulletState¶
- damage: float¶
- energy: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class HitWallEvent(turn_number: int)[source]¶
Bases:
BotEventEvent occurring when your bot has hit a wall.
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class RoundEndedEvent(round_number: int, turn_number: int, results: BotResults)[source]¶
Bases:
EventABCRepresents an event triggered when a round has ended in Robocode.
- Variables:
round_number (int) – The number of the round that just ended.
turn_number (int) – The final turn number of the round.
results (BotResults) – The accumulated results of all bots at the end of the round.
- round_number: int¶
- turn_number: int¶
- results: BotResults¶
- class RoundStartedEvent(round_number: int)[source]¶
Bases:
EventABCRepresents an event that occurs when a new round has started.
- Variables:
round_number (int) – The number of the current round.
- round_number: int¶
- class ScannedBotEvent(turn_number: int, scanned_by_bot_id: int, scanned_bot_id: int, energy: float, x: float, y: float, direction: float, speed: float)[source]¶
Bases:
BotEventEvent triggered when a bot scans another bot.
- Variables:
scanned_by_bot_id (int) – The ID of the bot that performed the scanning.
scanned_bot_id (int) – The ID of the bot that was scanned.
energy (float) – The energy level of the scanned bot.
x (float) – The X-coordinate of the scanned bot.
y (float) – The Y-coordinate of the scanned bot.
direction (float) – The direction (in degrees) of the scanned bot.
speed (float) – The speed (in units per turn) of the scanned bot.
- scanned_by_bot_id: int¶
- scanned_bot_id: int¶
- energy: float¶
- x: float¶
- y: float¶
- direction: float¶
- speed: float¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class SkippedTurnEvent(turn_number: int)[source]¶
Bases:
BotEventRepresents an event triggered when the bot has skipped a turn.
This event occurs when the bot fails to take its turn within the allotted time frame.
- property critical: bool¶
Indicates whether this event is critical.
- Returns:
Always returns True, as skipping a turn is considered a critical event.
- Return type:
bool
- turn_number: int¶
- class TeamMessageEvent(turn_number: int, message: Any, sender_id: int)[source]¶
Bases:
BotEventRepresents an event triggered when a bot has received a message from a teammate during a specific turn.
- Variables:
message (Any) – The message sent by the teammate. Cannot be None.
sender_id (int) – The unique ID of the teammate who sent the message.
- message: Any¶
- sender_id: int¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶
- class TickEvent(turn_number: int, round_number: int, bot_state: BotState | None, bullet_states: Sequence[BulletState | None] | None, events: Sequence[BotEvent])[source]¶
Bases:
BotEventRepresents an event that occurs at the start of a new turn within a round.
- Variables:
round_number (int) – The current round number in the battle.
bot_state (BotState) – The current state of the bot.
bullet_states (list[BulletState]) – A list containing the states of bullets fired by the bot.
events (list[BotEvent]) – A list of events that occurred in this turn.
- round_number: int¶
- bullet_states: Sequence[BulletState | None] | None¶
- property critical: bool¶
Determines whether the event is critical. By default, events are not critical, but subclasses can override this to provide event-specific criticality logic. :returns: False by default. :rtype: bool
- turn_number: int¶