bot arena
✦ NOW WITH MAZES! ✦ WRITE A BOT ✦ POINT IT AT THE API ✦ NOW WITH LEADERBOARDS ✦ TWO-PLAYER GAMES AFTER THAT ✦ ✦ NOW WITH MAZES! ✦ WRITE A BOT ✦ POINT IT AT THE API ✦ NOW WITH LEADERBOARDS ✦ TWO-PLAYER GAMES AFTER THAT ✦ 

API docs

Everything a bot needs to play. Plain REST and JSON: send a request, get JSON back. The arena lives at https://bot-arena.lastdog.app.

Getting started

  1. Log in (this creates your account).
  2. Create a bot on the Bots page and copy its Bot ID.
  3. Create a key on the API keys page. It is shown once: save it.
  4. Call /create_maze, then /look and /move until you reach the target.

Authentication

Send your API key as a bearer token in the Authorization header of every call:

Authorization: Bearer ba_…

A key acts as you, so keep it out of source control and logs. We store only a hash of it: if you lose one, delete it and make another. Each game belongs to one of your bots, named by bot_uuid when you create the maze.

Conventions

When something is wrong you get an HTTP error with no JSON body:

StatusMeans
400 / 415The body is not JSON, or the Content-Type header is missing.
422Valid JSON, but not a valid action: a missing field, an axis that is not 0 or 1, a direction of 0, or a game that is over.
500Something broke on our side.

Endpoints

POST /create_maze

Start a game: a new square maze for one of your bots.

You always start in the top-left corner, (0, 0). The target is placed at random.

You learn where the target is, but not where the walls are: that is what /look is for.

Request body

FieldTypeMeaning
sizeintegerWidth and height of the maze, in squares.
bot_uuiduuidWhich of your bots is playing: its Bot ID from the Bots page.
{
  "size": 10,
  "bot_uuid": "d0000000-0000-4000-8000-000000000002"
}

Response

FieldTypeMeaning
game_iduuidNames this game in every later call.
start_locationLocationWhere you are now: always (0, 0).
target_locationLocationThe square to reach.
{
  "game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
  "start_location": {
    "x": 0,
    "y": 0
  },
  "target_location": {
    "x": 7,
    "y": 4
  }
}

POST /look

How far is clear along an axis, from where you stand.

Looking never moves you.

Request body

FieldTypeMeaning
game_iduuidThe game, as returned by /create_maze.
axisinteger, 0 or 10 is x (left–right), 1 is y (up–down).
directioninteger, not 0Only the sign counts: positive looks right (x) or down (y), negative looks left or up.
{
  "game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
  "axis": 0,
  "direction": 1
}

Response

FieldTypeMeaning
free_spacesinteger ≥ 0Squares you could move that way before a wall or the edge of the maze.
{
  "free_spaces": 3
}

POST /move

Move along an axis. A wall stops you short.

You travel |distance| squares, or as far as the first wall if that is nearer.

Every call counts as a move, so a bump into a wall costs one too.

Request body

FieldTypeMeaning
game_iduuidThe game, as returned by /create_maze.
axisinteger, 0 or 10 is x (left–right), 1 is y (up–down).
distanceinteger, not 0How far to go. The sign is the direction: positive is right (x) or down (y).
{
  "game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f",
  "axis": 1,
  "distance": -2
}

Response

FieldTypeMeaning
absolute_distance_traveledinteger ≥ 0How far you actually went: between 0 and |distance|.
winnerbooleanTrue when this move stopped you on the target.
{
  "absolute_distance_traveled": 2,
  "winner": false
}

POST /quit

Abandon a game.

Request body

FieldTypeMeaning
game_iduuidThe game, as returned by /create_maze.
{
  "game_id": "3f2a9c1e-0a7d-4b2c-8e6f-1a3b5c7d9e0f"
}

Response

200 OK with an empty body.

GET /healthz

Is the arena up? No API key or body needed.

503 Service Unavailable when the arena cannot reach its database.

Response

FieldTypeMeaning
statusstring"Ok" when the arena is serving.
{
  "status": "Ok"
}

A whole game with curl

ARENA=https://bot-arena.lastdog.app
KEY=ba_…        # from the API keys page
BOT=…           # your Bot ID, from the Bots page

curl -s $ARENA/create_maze -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"size": 10, "bot_uuid": "'$BOT'"}'
# {"game_id":"3f2a…","start_location":{"x":0,"y":0},"target_location":{"x":7,"y":4}}

GAME=3f2a…      # the game_id from above

curl -s $ARENA/look -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"game_id": "'$GAME'", "axis": 0, "direction": 1}'
# {"free_spaces":3}

curl -s $ARENA/move -H "Authorization: Bearer $KEY" \
  -H "Content-Type: application/json" -d '{"game_id": "'$GAME'", "axis": 0, "distance": 3}'
# {"absolute_distance_traveled":3,"winner":false}

The exact Rust types for every body are in crates/arena_api. For a working client, see test_bot in the arena's repository.

bot arenaWRITE A BOT!GET AN API KEYHOTLINE CAFÉ800×600 FRIENDLY