Robocode Tank Royale Bot API
    Preparing search index...

    Interface IBot

    Interface for a bot that extends IBaseBot with blocking movement methods.

    This interface adds the ability to execute blocking movement commands that wait until the movement is completed before returning.

    interface IBot {
        MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN: 10;
        TEAM_MESSAGE_MAX_SIZE: 32768;
        addCustomEvent(condition: Condition): boolean;
        back(distance: number): void;
        bearingTo(x: number, y: number): number;
        broadcastTeamMessage(message: unknown): void;
        calcBearing(direction: number): number;
        calcBulletSpeed(firepower: number): number;
        calcDeltaAngle(targetAngle: number, sourceAngle: number): number;
        calcGunBearing(direction: number): number;
        calcGunHeat(firepower: number): number;
        calcMaxTurnRate(speed: number): number;
        calcRadarBearing(direction: number): number;
        clearEvents(): void;
        directionTo(x: number, y: number): number;
        distanceTo(x: number, y: number): number;
        fire(firepower: number): void;
        forward(distance: number): void;
        getArenaHeight(): number;
        getArenaWidth(): number;
        getBodyColor(): Color | null;
        getBulletColor(): Color | null;
        getBulletStates(): ReadonlySet<BulletState>;
        getDirection(): number;
        getDistanceRemaining(): number;
        getEnemyCount(): number;
        getEnergy(): number;
        getEventPriority(eventType: string): number;
        getEvents(): BotEvent[];
        getFirepower(): number;
        getGameType(): string;
        getGraphics(): IGraphics;
        getGunColor(): Color | null;
        getGunCoolingRate(): number;
        getGunDirection(): number;
        getGunHeat(): number;
        getGunTurnRate(): number;
        getGunTurnRemaining(): number;
        getMaxGunTurnRate(): number;
        getMaxInactivityTurns(): number;
        getMaxRadarTurnRate(): number;
        getMaxSpeed(): number;
        getMaxTurnRate(): number;
        getMyId(): number;
        getNumberOfRounds(): number;
        getRadarColor(): Color | null;
        getRadarDirection(): number;
        getRadarTurnRate(): number;
        getRadarTurnRemaining(): number;
        getRoundNumber(): number;
        getScanColor(): Color | null;
        getSpeed(): number;
        getTargetSpeed(): number;
        getTeammateIds(): ReadonlySet<number>;
        getTimeLeft(): number;
        getTracksColor(): Color | null;
        getTurnNumber(): number;
        getTurnRate(): number;
        getTurnRemaining(): number;
        getTurnTimeout(): number;
        getTurretColor(): Color | null;
        getVariant(): string;
        getVersion(): string;
        getX(): number;
        getY(): number;
        go(): void;
        gunBearingTo(x: number, y: number): number;
        isAdjustGunForBodyTurn(): boolean;
        isAdjustRadarForBodyTurn(): boolean;
        isAdjustRadarForGunTurn(): boolean;
        isDebuggingEnabled(): boolean;
        isDisabled(): boolean;
        isRunning(): boolean;
        isStopped(): boolean;
        isTeammate(botId: number): boolean;
        normalizeAbsoluteAngle(angle: number): number;
        normalizeRelativeAngle(angle: number): number;
        onBotDeath(event: BotDeathEvent): void;
        onBulletFired(event: BulletFiredEvent): void;
        onBulletHitBot(event: BulletHitBotEvent): void;
        onBulletHitBullet(event: BulletHitBulletEvent): void;
        onBulletHitWall(event: BulletHitWallEvent): void;
        onConnected(event: ConnectedEvent): void;
        onConnectionError(event: ConnectionErrorEvent): void;
        onCustomEvent(event: CustomEvent): void;
        onDeath(event: DeathEvent): void;
        onDisconnected(event: DisconnectedEvent): void;
        onGameEnded(event: GameEndedEvent): void;
        onGameStarted(event: GameStartedEvent): void;
        onHitBot(event: HitBotEvent): void;
        onHitByBullet(event: HitByBulletEvent): void;
        onHitWall(event: HitWallEvent): void;
        onRoundEnded(event: RoundEndedEvent): void;
        onRoundStarted(event: RoundStartedEvent): void;
        onScannedBot(event: ScannedBotEvent): void;
        onSkippedTurn(event: SkippedTurnEvent): void;
        onTeamMessage(event: TeamMessageEvent): void;
        onTick(event: TickEvent): void;
        onWonRound(event: WonRoundEvent): void;
        radarBearingTo(x: number, y: number): number;
        removeCustomEvent(condition: Condition): boolean;
        rescan(): void;
        resume(): void;
        run(): void;
        sendTeamMessage(teammateId: number, message: unknown): void;
        setAdjustGunForBodyTurn(adjust: boolean): void;
        setAdjustRadarForBodyTurn(adjust: boolean): void;
        setAdjustRadarForGunTurn(adjust: boolean): void;
        setBack(distance: number): void;
        setBodyColor(color: Color | null): void;
        setBulletColor(color: Color | null): void;
        setEventPriority(eventType: string, priority: number): void;
        setFire(firepower: number): boolean;
        setFireAssist(enable: boolean): void;
        setForward(distance: number): void;
        setGunColor(color: Color | null): void;
        setGunTurnRate(gunTurnRate: number): void;
        setInterruptible(interruptible: boolean): void;
        setMaxGunTurnRate(maxGunTurnRate: number): void;
        setMaxRadarTurnRate(maxRadarTurnRate: number): void;
        setMaxSpeed(maxSpeed: number): void;
        setMaxTurnRate(maxTurnRate: number): void;
        setRadarColor(color: Color | null): void;
        setRadarTurnRate(radarTurnRate: number): void;
        setRescan(): void;
        setResume(): void;
        setScanColor(color: Color | null): void;
        setStop(): void;
        setStop(overwrite: boolean): void;
        setTargetSpeed(targetSpeed: number): void;
        setTracksColor(color: Color | null): void;
        setTurnGunLeft(degrees: number): void;
        setTurnGunRight(degrees: number): void;
        setTurnLeft(degrees: number): void;
        setTurnRadarLeft(degrees: number): void;
        setTurnRadarRight(degrees: number): void;
        setTurnRate(turnRate: number): void;
        setTurnRight(degrees: number): void;
        setTurretColor(color: Color | null): void;
        start(): void;
        stop(): void;
        stop(overwrite: boolean): void;
        turnGunLeft(degrees: number): void;
        turnGunRight(degrees: number): void;
        turnLeft(degrees: number): void;
        turnRadarLeft(degrees: number): void;
        turnRadarRight(degrees: number): void;
        turnRight(degrees: number): void;
        waitFor(condition: Condition): void;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    Methods

    addCustomEvent back bearingTo broadcastTeamMessage calcBearing calcBulletSpeed calcDeltaAngle calcGunBearing calcGunHeat calcMaxTurnRate calcRadarBearing clearEvents directionTo distanceTo fire forward getArenaHeight getArenaWidth getBodyColor getBulletColor getBulletStates getDirection getDistanceRemaining getEnemyCount getEnergy getEventPriority getEvents getFirepower getGameType getGraphics getGunColor getGunCoolingRate getGunDirection getGunHeat getGunTurnRate getGunTurnRemaining getMaxGunTurnRate getMaxInactivityTurns getMaxRadarTurnRate getMaxSpeed getMaxTurnRate getMyId getNumberOfRounds getRadarColor getRadarDirection getRadarTurnRate getRadarTurnRemaining getRoundNumber getScanColor getSpeed getTargetSpeed getTeammateIds getTimeLeft getTracksColor getTurnNumber getTurnRate getTurnRemaining getTurnTimeout getTurretColor getVariant getVersion getX getY go gunBearingTo isAdjustGunForBodyTurn isAdjustRadarForBodyTurn isAdjustRadarForGunTurn isDebuggingEnabled isDisabled isRunning isStopped isTeammate normalizeAbsoluteAngle normalizeRelativeAngle onBotDeath onBulletFired onBulletHitBot onBulletHitBullet onBulletHitWall onConnected onConnectionError onCustomEvent onDeath onDisconnected onGameEnded onGameStarted onHitBot onHitByBullet onHitWall onRoundEnded onRoundStarted onScannedBot onSkippedTurn onTeamMessage onTick onWonRound radarBearingTo removeCustomEvent rescan resume run sendTeamMessage setAdjustGunForBodyTurn setAdjustRadarForBodyTurn setAdjustRadarForGunTurn setBack setBodyColor setBulletColor setEventPriority setFire setFireAssist setForward setGunColor setGunTurnRate setInterruptible setMaxGunTurnRate setMaxRadarTurnRate setMaxSpeed setMaxTurnRate setRadarColor setRadarTurnRate setRescan setResume setScanColor setStop setTargetSpeed setTracksColor setTurnGunLeft setTurnGunRight setTurnLeft setTurnRadarLeft setTurnRadarRight setTurnRate setTurnRight setTurretColor start stop turnGunLeft turnGunRight turnLeft turnRadarLeft turnRadarRight turnRight waitFor

    Properties

    MAX_NUMBER_OF_TEAM_MESSAGES_PER_TURN: 10

    The maximum number of team messages that can be sent per turn.

    TEAM_MESSAGE_MAX_SIZE: 32768

    The maximum size of a team message in bytes (32 KB).

    Methods

    • Moves the bot backward by the given distance (blocking). Blocks until the movement is completed.

      Parameters

      • distance: number

        the distance to move backward in units.

      Returns void

    • Calculates the bearing from the bot's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the bearing (angle) from the bot's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the bullet speed for a given firepower.

      Parameters

      • firepower: number

      Returns number

    • Calculates the delta angle between a target angle and a source angle.

      Parameters

      • targetAngle: number

        the target angle.

      • sourceAngle: number

        the source angle.

      Returns number

      the delta angle in degrees in the range [-180, 180].

    • Calculates the bearing from the gun's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the gun heat for a given firepower.

      Parameters

      • firepower: number

      Returns number

    • Calculates the maximum turn rate for a given speed.

      Parameters

      • speed: number

      Returns number

    • Calculates the bearing from the radar's direction to the given direction.

      Parameters

      • direction: number

        the direction to calculate the bearing to.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Calculates the direction from the bot to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the direction in degrees in the range [0, 360).

    • Calculates the distance from the bot to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the distance in units.

    • Fires the gun with the given firepower (blocking). Blocks until the next turn after firing.

      Parameters

      • firepower: number

        the firepower to fire with.

      Returns void

    • Moves the bot forward by the given distance (blocking). Blocks until the movement is completed.

      Parameters

      • distance: number

        the distance to move forward in units.

      Returns void

    • Height of the arena measured in units. First available when the game has started.

      Returns number

    • Width of the arena measured in units. First available when the game has started.

      Returns number

    • The distance remaining until the bot has finished moving.

      Returns number

    • Gets the event priority for a given event type name.

      Parameters

      • eventType: string

      Returns number

    • Game type, e.g. "melee" or "1v1". First available when the game has started.

      Returns string

    • The gun heat of the bot. The gun cannot fire when the gun heat is > 0.

      Returns number

    • The gun turn remaining until the gun has finished turning.

      Returns number

    • Unique id of this bot, available when the game has started.

      Returns number

    • The radar turn remaining until the radar has finished turning.

      Returns number

    • The number of microseconds left of this turn before the bot will skip the turn.

      Returns number

    • The turn remaining until the bot has finished turning.

      Returns number

    • Commits the current commands (actions), finalizing the current turn for the bot. Must be called once per turn before the turn timeout occurs.

      Returns void

    • Calculates the bearing from the gun's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Returns whether the bot is currently running.

      Returns boolean

    • Returns whether the given bot ID is a teammate.

      Parameters

      • botId: number

      Returns boolean

    • Normalizes an angle to an absolute angle in the range [0, 360).

      Parameters

      • angle: number

        the angle to normalize.

      Returns number

      the normalized angle.

    • Normalizes an angle to a relative angle in the range [-180, 180].

      Parameters

      • angle: number

        the angle to normalize.

      Returns number

      the normalized angle.

    • Calculates the bearing from the radar's direction to the given coordinates.

      Parameters

      • x: number

        the X coordinate.

      • y: number

        the Y coordinate.

      Returns number

      the bearing in degrees in the range [-180, 180].

    • Rescans with the radar (blocking). Blocks until the next turn.

      Returns void

    • Resumes movement after a stop (blocking). Blocks until the next turn.

      Returns void

    • The main method for the bot. Override this to implement the bot's behavior. This method is called when the bot starts running in a new round.

      Returns void

    • Sends a message to a specific teammate.

      Parameters

      • teammateId: number
      • message: unknown

      Returns void

    • Sets the bot to move backward by the given distance (non-blocking).

      Parameters

      • distance: number

        the distance to move backward in units.

      Returns void

    • Sets the event priority for a given event type name.

      Parameters

      • eventType: string
      • priority: number

      Returns void

    • Sets the gun to fire with the given firepower. Returns true if the gun will fire, false if not. The gun will not fire if the gun is still hot, or the firepower is out of range.

      Parameters

      • firepower: number

      Returns boolean

    • Sets the bot to move forward by the given distance (non-blocking).

      Parameters

      • distance: number

        the distance to move forward in units.

      Returns void

    • Sets the gun turn rate in degrees per turn.

      Parameters

      • gunTurnRate: number

      Returns void

    • Sets whether the current event handler is interruptible.

      Parameters

      • interruptible: boolean

      Returns void

    • Sets the maximum gun turn rate in degrees per turn.

      Parameters

      • maxGunTurnRate: number

      Returns void

    • Sets the maximum radar turn rate in degrees per turn.

      Parameters

      • maxRadarTurnRate: number

      Returns void

    • Sets the maximum speed in units per turn.

      Parameters

      • maxSpeed: number

      Returns void

    • Sets the maximum turn rate of the bot in degrees per turn.

      Parameters

      • maxTurnRate: number

      Returns void

    • Sets the radar turn rate in degrees per turn.

      Parameters

      • radarTurnRate: number

      Returns void

    • Sets the bot to stop all movement.

      Returns void

    • Sets the bot to stop all movement, optionally overwriting a previous stop.

      Parameters

      • overwrite: boolean

      Returns void

    • Sets the target speed in units per turn.

      Parameters

      • targetSpeed: number

      Returns void

    • Sets the gun to turn left by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn the gun left.

      Returns void

    • Sets the gun to turn right by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn the gun right.

      Returns void

    • Sets the bot to turn left by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn left.

      Returns void

    • Sets the radar to turn left by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn the radar left.

      Returns void

    • Sets the radar to turn right by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn the radar right.

      Returns void

    • Sets the turn rate of the bot in degrees per turn.

      Parameters

      • turnRate: number

      Returns void

    • Sets the bot to turn right by the given degrees (non-blocking).

      Parameters

      • degrees: number

        the degrees to turn right.

      Returns void

    • Starts the bot, connecting to the server and running until the game ends.

      Returns void

    • Stops all movement (blocking). Blocks until the next turn.

      Returns void

    • Stops all movement (blocking), optionally overwriting a previous stop. Blocks until the next turn.

      Parameters

      • overwrite: boolean

        whether to overwrite a previous stop.

      Returns void

    • Turns the gun left by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn the gun left.

      Returns void

    • Turns the gun right by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn the gun right.

      Returns void

    • Turns the bot left by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn left.

      Returns void

    • Turns the radar left by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn the radar left.

      Returns void

    • Turns the radar right by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn the radar right.

      Returns void

    • Turns the bot right by the given degrees (blocking). Blocks until the turn is completed.

      Parameters

      • degrees: number

        the degrees to turn right.

      Returns void

    • Waits until the given condition is true, calling go() each turn.

      Parameters

      • condition: Condition

        the condition to wait for.

      Returns void