Actions

Each time your bot’s decide method runs, it must return exactly one action built with the Actions helpers below. The game will then apply that action’s effect to your bot. Most actions are directional - they will behave differently depending on the direction a bot is facing.

Basic Actions

Basic actions can be performed at any point a bot is not stunned. These are less powerful than special actions as they are a lot more limited in what they allow the bot to do, however, they have no cooldowns and can thus be performed more frequently.

Move

Actions.move() moves one hex straight ahead in the direction a bot is currently facing, and paints the tile it lands on.

If the step would leave the grid, nothing happens.

Move East

Player 1 faces east. Play applies Actions.move() - step one hex east and paint the landing tile.

from utils.actions import Actions


class Bot:
    def decide(self, game_state):
        """This bot will move in a straight line forever."""
        return Actions.move()

Facing and Turning

Moving around would be useless without a way for a bot to control its direction. To change which direction it is facing, there are a few actions that a bot can take:

Turn Left

Actions.turn_left(steps=1) — Turn some number of steps left (default to 1 step)

Turn One Step Left

Play applies Actions.turn_left() - the marker pivots left (E → NE).

Turn Right

Actions.turn_right(steps=1) — Turn some number of steps right (default to 1 step)

Turn Two Steps Right

Play applies Actions.turn_right(2) - the marker pivots 2 tiles right (E → SW).

Turn Around

Actions.turn_180() — Turn to face the opposite direction.

Turn 180 Degrees

Play applies Actions.turn_180() - the marker faces the opposite directions (E → W).

Face Direction

Actions.face_direction(direction) — Set facing to the given HexDirection or integer 05.

Face Southwest

Play applies Actions.face_direction(HexDirection.SW) - turn to that direction (E → SW).

Turning does not move the bot or paint tiles - only the direction the bot faces changes.

Skip

The skip action tells a splatbot to skip a turn. It is the only legal action for a bot to take while it is stunned.

Skip

Play applies Actions.skip() - nothing happens.

from utils.actions import Actions


class Bot:
    def decide(self, game_state):
        """ This bot will not do anything. How lazy! """
        return Actions.skip()

Special Actions

Special actions are more powerful than basic actions. However, these actions have a cooldown that must finish before the action is allowed to be performed again.

Especially powerful special actions will also stun the user for a few turns, preventing them from taking any actions at all until the stun expires. The exact values of these penalties are configurable in the settings menu of the game.

Definitions:
Stun: A number of turns a bot cannot perform any action
Cooldown: A number of turns before a bot can repeat the action “cooling down”

Splat

Actions.splat() paints every neighbor of a bot’s current hex.

Default settings:

  • Stun: 3 turns
  • Cooldown: 10 turns

Splat!

Play applies Actions.splat() - all tiles neighboring the bot are painted.

from utils.actions import Actions


class Bot:
    def decide(self, game_state):
        # If stunned, do nothing
        if game_state.me.stun > 0:
            return Actions.skip()
        # Splat if possible
        if game_state.me.splat_cooldown == 0:
            return Actions.splat()
        # Otherwise, move forwards
        return Actions.move()

The game_state variable will be explained more in Writing Bots.

Shoot paintball

Actions.shoot_paintball() will fire a paintball in the direction a bot is currently facing. Thanks to advanced bot technology™, paintballs travel instantaneously. A paintball will travel until it collides with either another bot or the edge of the map.

Default settings:

  • Stun: 7 turns
  • Cooldown: 20 turns

Shoot Paintball

Play applies Actions.shoot_paintball() - all tiles in front of the bot are painted up to the edge of the map.

Shoot Paintball (Bot Collision)

Play applies Actions.shoot_paintball() - all tiles in front of the bot are painted until the paintball hits another bot.

from utils.actions import Actions


class Bot:
    def decide(self, game_state):
        # If stunned, do nothing
        if game_state.me.stun > 0:
            return Actions.skip()
        # If a paintball can be shot, use it
        if game_state.me.paintball_cooldown == 0:
            return Actions.shoot_paintball()
        # Otherwise, move forwards
        return Actions.move()

Dash

Actions.dash(distance) moves a bot 2–6 hexes straight ahead, and only paints the destination hex.

Default settings:

  • Stun: 0 turns
  • Cooldown: 7 turns

If the full distance of a dash would have the bot leave the grid, it will stop at the last in-grid hex along that direction (the edge of the grid).

Dash Bot

Play applies Actions.dash(4) - the bot moves 4 and paints the tile it lands on.

from utils.actions import Actions


class Bot:
    def decide(self, game_state):
        # If stunned, do nothing
        if game_state.me.stun > 0:
            return Actions.skip()
        # Dash if possible
        if game_state.me.dash_cooldown == 0:
            return Actions.dash(6)
        # Otherwise, just walk like a normal person
        return Actions.move()