Files
pokerfreak/docs/VERTRAG.md
T

63 lines
2.3 KiB
Markdown

# Contract: Offline Poker Decision Core
Purpose: a **pure decision engine**. No client, no network, no poker-room rules.
Input is JSON, output is JSON. Nothing else needs to be known.
## Interface
* **stdin**: one JSON object per line — one decision request.
* **stdout**: one JSON object per line — the decision.
* No prompts, no logging on stdout, **no external dependencies** (standard library only).
* Language: your choice — Python or Rust preferred. The JSON contract is what counts.
## Request (exact field names)
```json
{
"variant": "NLHE",
"bigBlind": 0.1,
"seats": 6,
"heroSeat": 5,
"heroCards": [{"rank": "A", "suit": "HEARTS"}, {"rank": "5", "suit": "HEARTS"}],
"board": {"FLOP": [{"rank": "A", "suit": "CLUBS"}], "TURN": null, "RIVER": null},
"street": "FLOP",
"pot": 1.25,
"toCall": 0.2,
"heroStack": 2.4,
"minRaiseTo": 0.5,
"maxRaiseTo": 20.0,
"legalActions": ["FOLD", "CALL", "RAISE"],
"allowedSizes": [0.5, 1.15, 4.6],
"villains": [{"seat": 2, "stack": 10.4, "folded": false}]
}
```
* `rank` values: `TWO … TEN, JACK, QUEEN, KING, ACE`; `suit` values: `CLUBS, DIAMONDS, HEARTS, SPADES`.
* `board` streets are `null` or a list of cards.
* `legalActions` is authoritative — nothing outside it may be returned.
* `allowedSizes` is optional (given by the client in some formats); when present, a raise size
must be one of these values.
* `variant` values: `NLHE`, `PLO5`, `K_POKER`, `AOF`.
## Response
```json
{"action": "CALL", "size": null, "confidence": 0.72, "reason": "top pair, good price"}
```
* `action`: `FOLD`, `CHECK`, `CALL`, `RAISE` or **`ABSTAIN`**.
* `size`: the total amount for a raise, otherwise `null`.
* `confidence`: `0..1`.
* `ABSTAIN` means: the engine is not sure — the caller decides what to do.
## Requirements
1. Pure functions only; stdlib only.
2. Never return an action outside `legalActions`.
3. Preflop: chart-based, by position and action sequence.
4. Postflop: equity (Monte-Carlo is fine), pot odds, expected value per legal action.
5. `K_POKER`: if `allowedSizes` is present, pick from it and never invent a size.
6. `AOF`: binary decision only.
7. Include a test suite that runs offline, plus one CLI entry point.
8. No discussion about rooms, tools, HUDs, terms of service or detection. Only maths.