Get action: action object

On its turn, the bot will need to perform an action.

Action Object is the output of the bot's Get Action function. The Action Object has two fields: action and params. The params are the parameters needed to perform the action.

Examples

Tic-Tac-Toe

A player can make only one type of action in this game: place a piece in one of the 9 squares. The action object will look something like

{
    "action": "place_piece",
    "params": {
        "index": 3
    }
}

When the bot Get Action function returns the above object, the game server will attempt to place a piece at index 3 for the player_turn_idx that is making the move.

Battleship

A player can make two types of actions in this game: placing ships and firing shots. During the PLACE_SHIP phase, the action object should look like

{
    "action": "place_ships",
    "params": {
        "ships": [
            // destroyer
            {"x": 3, "y": 4}, 
            {"x": 3, "y": 5},
            // submarine
            {"x": 7, "y": 4}, 
            {"x": 8, "y": 4}, 
            {"x": 9, "y": 4},
            //...other ships
        ]
    }
}

During the FIRE_SHOT phase, the action object should look like

{
    "action": "fire_shot",
    "params": {
        "x": 3,
        "y": 5
    }
}

Passing a turn

The bot must return an action during its turn. If the function returns null or fails to return an object, it will be forfeit the game. For games where it is valid to pass a turn, the action schema should include an explicit action to do so. The action object for this might look like

{
    "action": "pass_turn"
}

Last updated