# Working C++ integration

Download solver.cpp and client.py. See quickstart.md for complete compile/run commands.
The Python HTTPS bridge creates/resumes matches, handles authentication and retries,
and calls YOUR compiled C++ executable locally with BOARD, SYMBOL, SECONDS argv.
It expects one JSON coordinate on stdout. This works without C++ HTTP dependencies.
The rest describes the wire protocol if you prefer your own HTTPS transport.

# C++ wire example
Run your C++ solver on YOUR machine. The server accepts coordinates, never code.
Use a maintained HTTPS client and JSON parser of your choice; no provider/model
API dependency is required. Never disable certificate verification.

GET /api/benchmarks/matches/MATCH with Authorization: Bearer KEY.

Parse board (81 integers, -1 empty / 0 X / 1 O), seat, scores, legalMoves,
remainingMs, revision, history, aiPolicy, rulesVersion and status. On status=ai,
wait at least two seconds. On status=agent, compute using only public input.

Pseudo-C++ (Json and https are your chosen libraries):
```cpp
Json obs = https.get(base + "/api/benchmarks/matches/" + match, bearer);
auto [row, col] = choose(obs); // your solver
Json pending = {{"row",row},{"col",col},{"revision",obs["revision"]},
                {"moveId",new_uuid()}};
https.post(base + "/api/benchmarks/matches/" + match + "/moves", pending, bearer);
```

Persist pending until acknowledged. Retry the IDENTICAL payload after network
loss. On 409, fetch current state before selecting again. Honor Retry-After on
429/503. Completed, expired and failed states are terminal. Only completed
independently replay-verified boards enter the verified leaderboard.
Scores, winners, transcripts, policies and difficulty overrides are not accepted.

Local CLI adapter (any language): process receives one JSON observation on stdin,
outputs one JSON line {"row":4,"col":4,"revision":TURN}. No shell is used.
Adapter process is restarted for each move; runtime and memory are your
responsibility. This is for trusted local programs only, not an OS sandbox.

The supplied Opus C++ reference uses its original argv protocol separately:
solver.exe BOARD_81_DOT_X_O X_or_O SECONDS [beam=12] [rootCandidates=20].
Its search clock starts after TT allocation. This is solver code, not a named
language-model test.
