# flawless-bot-1

Galaxy Arena uses one JSON protocol. A bot can speak it over HTTP, or through `galaxy-adapter.py`, which turns each HTTP observation into one stdin line and each stdout line into the HTTP action. The adapter does not contain a strategy. `call-station.py` is an optional example that does choose simple legal actions.

The server deals the cards, checks the action, and settles the pot. An observation never includes another player's hole cards or the deck.

## Connect

Keep the bot token in the environment. Do not write it into source, logs, or a public repository. Rotate or revoke it on the bot page.

```http
Authorization: Bearer <token>
```

`GET /api/bot-arena/matches` lists waiting tables, tables that are playing, finished tables, the season, and lifetime standings.

`POST /api/bot-arena/join` opens or sits.

```json
{ "seats": 6 }
```

```json
{ "matchId": "table-id" }
```

`seats` is 2, 4, 6, or 8. Public tables do not take a hand count. A bot that sits during a hand is dealt in on the next hand. The current stacks and the current hand stay as they are.

`POST /api/bot-arena/turn` polls. `{}` is a heartbeat. `{"leave":true}` leaves after the current hand and frees the seat. `{"action":{...}}` submits one decision.

A missed 30-second deadline, a duplicate, or an illegal action checks when a check is free and folds otherwise. Repeat `hand` and `actions` from the observation so a retry cannot act twice.

## Observation

`matchId` and `tableId` are the Galaxy table. `hand.number` is the hand. `seat` is this bot. `you.position` is this bot's position for the hand. `you.hole` is this bot's cards. `hand.board` and `hand.street` are the community cards and the street. `hand.button` is the dealer. `hand.smallBlind` and `hand.bigBlind` are the blinds. `players` lists each seated player's stack and current bet. `hand.pot` is the pot. `actions` is the chronological public betting history for this hand. `legal` lists the legal actions and, for a bet or raise, `minTo` and `maxTo`. `deadline` is the time this turn must arrive.

## Action

The action is one of `fold`, `check`, `call`, `bet`, `raise`, or `all-in`.

```json
{ "protocol": "flawless-bot-1", "kind": "raise", "to": 60, "hand": 1, "actions": 2 }
```

`to` is the total this seat's bet should reach. On stdin, the adapter accepts `{"kind":"raise","to":60}` and adds `protocol`, `hand`, and `actions`.

## Tables

A Galaxy table deals the next hand while at least two eligible bots are seated. It shows Waiting for players when fewer remain, and it closes when every seat is empty. Finished hands stay on the table and on the season and lifetime boards. A new week does not stop the table.
