FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

nullptr0807/PokerArena · GitHub

Repository files navigation

PokerArena

A server-authoritative No-Limit Texas Hold'em platform and C++ poker-AI research lab.

PokerArena combines a real-time multiplayer poker application with an experimental MCCFR engine. The web and iOS clients send player intent; the backend owns cards, legal actions, pots, showdown, persistence, and AI orchestration.

Important

The application is playable, but the AI research is not a finished GTO product. This repository does not claim NL50 strength, low exploitability, or production-ready game-theoretic optimality. Trained blueprints are large generated artifacts and are not included in Git.

What works today

Poker application

  • 2–6 seat No-Limit Texas Hold'em rooms
  • Account authentication and room-scoped WebSocket tickets
  • Server-authoritative dealing, betting, side pots, showdown, and settlement
  • Human players, AI seats, spectators, chat, reconnect, and control handoff
  • Per-viewer hole-card privacy
  • Raw hand histories plus derived VPIP, PFR, BB/100, and decision events
  • Run-it-multiple support in the game engine
  • React/TypeScript web table with responsive desktop and mobile layouts
  • Optional iOS client/reference implementation

AI and research tooling

  • C++20 MCCFR trainer and blueprint format
  • Persistent C++ JSON decision server
  • Hand-strength abstraction and public-state tooling
  • Opponent profiling and guarded exploit experiments
  • Bounded local-solving research code
  • Reproducible training seeds, checkpoints, resource profiling, and artifact metadata
  • Paired, rake-aware evaluation across multiple opponent profiles and seeds
  • Exact Kuhn-poker convergence tests and runtime protocol tests

Current AI status

PokerArena deliberately separates working software from unproven poker strength.

  • No trained model is committed to this repository.
  • Without a compatible blueprint, the backend falls back to heuristic AI.
  • A blueprint must match the engine version, public-state model, action abstraction, stack configuration, and adjacent metadata used to create it.
  • Historical candidates that improved one opponent type while regressing others were rejected rather than promoted.
  • Internal self-play is treated as diagnostic evidence, not proof that a model beats real NL50 players.

The detailed research record is in:

Architecture

                    HTTPS / WebSocket
┌────────────────┐                     ┌──────────────────────────┐
│ Web / iOS      │ ◄─────────────────► │ FastAPI backend          │
│ clients        │                     │                          │
└────────────────┘                     │ • auth and rooms         │
                                       │ • authoritative game     │
                                       │ • persistence and stats  │
                                       │ • AI orchestration       │
                                       └────────────┬─────────────┘
                                                    │ line-delimited JSON
                                                    ▼
                                       ┌──────────────────────────┐
                                       │ C++20 engine             │
                                       │                          │
                                       │ • blueprint lookup       │
                                       │ • MCCFR training         │
                                       │ • profiling / research   │
                                       │ • decision server        │
                                       └──────────────────────────┘

The backend is always authoritative. Clients never decide card order, action legality, pot distribution, or winners.

Repository layout

PokerArena/
├── backend/                 FastAPI, rooms, game engine, auth, stats, AI glue
│   ├── api/                 HTTP and WebSocket routes
│   ├── application/         Room and hand orchestration
│   ├── domain/              Transport-independent room rules
│   ├── game/                Hold'em state machine and settlement
│   ├── infrastructure/ai/   Persistent C++ decision client
│   └── tests/               Backend regression suite
├── frontend/                React 19 + TypeScript + Vite client
├── engine/                  C++20 trainer, runtime, probes, and tests
├── clients/ios/             iOS client/reference code
├── scripts/                 Training, evaluation, and diagnostic tools
├── doc/                     Architecture and research documentation
└── start.sh                 Local backend/frontend launcher

Quick start

Prerequisites

  • Python 3.12 or newer
  • Node.js 20 or newer
  • CMake 3.20+ and a C++20 compiler only if building the native engine

1. Clone and install

git clone https://github.com/nullptr0807/PokerArena.git
cd PokerArena

python3 -m venv backend/.venv
source backend/.venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -r backend/requirements.txt

cd frontend
npm ci
cd ..

2. Start the backend

source backend/.venv/bin/activate
cd backend
python -m uvicorn api.server:app --host 127.0.0.1 --port 8000 --reload

Check it:

curl http://127.0.0.1:8000/health

API documentation is available at http://127.0.0.1:8000/docs.

3. Start the frontend

In a second terminal:

cd frontend
npm run dev -- --host 127.0.0.1 --port 3000

Open http://127.0.0.1:3000.

One-command launcher

After installing both backend and frontend dependencies:

./start.sh

For a deployment mounted below /poker/ instead of /, set:

VITE_BASE_PATH=/poker/ ./start.sh

Configuration

The development defaults use SQLite and an in-memory room registry.

Variable Purpose Default
POKER_DATABASE_URL SQLModel database URL sqlite:///./data/poker_arena.db
POKER_JWT_SECRET JWT signing secret development-only placeholder
POKER_ENV development or production development
POKER_ENABLE_LEGACY_WS Enable unauthenticated legacy game socket enabled outside production
POKER_ROOM_REGISTRY memory or redis memory
POKER_REDIS_URL Redis connection URL redis://localhost:6379/0
POKER_AI_DECIDE_BINARY Path to the C++ decision server engine/build/decide
POKER_AI_BLUEPRINT_PATH Path to a compatible blueprint local generated run

Warning

Production startup rejects the default JWT secret. Set a strong POKER_JWT_SECRET, restrict CORS to trusted origins, disable the legacy WebSocket route, and use TLS at the reverse proxy.

Build the C++ engine

cmake -S engine -B engine/build -DCMAKE_BUILD_TYPE=Release
cmake --build engine/build -j
ctest --test-dir engine/build --output-on-failure

Main binaries:

Binary Purpose
engine/build/train MCCFR training
engine/build/decide Persistent JSON decision server
engine/build/blueprint_probe Inspect one runtime decision
engine/build/abstraction_audit Audit abstraction distortion
engine/build/continuation_probe Generate continuation-value evidence
engine/build/advantage_probe Generate repeated-action advantage evidence

A model run normally contains:

engine/runs/<run-id>/
├── blueprint.bin
├── abstraction.bin
├── metadata.json
├── checkpoint_*.bin
└── training.log

engine/runs/ and *.bin are intentionally ignored. Do not copy an arbitrary blueprint into the runtime and assume compatibility; validate its metadata and run a decision/evaluation smoke first.

Verification

Backend

source backend/.venv/bin/activate
cd backend
python -m pip install pytest
python -m pytest -q

Current verified result: 272 passed, 16 skipped.

Frontend

cd frontend
node --test tests/*.test.ts
npm audit --audit-level=high
npm run build

Current verified result: 24 tests passed, 0 known npm vulnerabilities, production build succeeded.

C++

cmake --build engine/build -j
ctest --test-dir engine/build --output-on-failure

Current verified result: 3/3 CTest targets passed.

How model changes are judged

A higher average score is not enough. A candidate must be compared with the current baseline using:

  1. the same cards, seats, opponent randomness, and rake;
  2. all calibrated opponent profiles, not one favorable matchup;
  3. multiple evaluation seeds;
  4. multiple training seeds for newly trained strategies;
  5. per-profile regression checks, not only an overall mean;
  6. untouched holdout evaluation after development is complete;
  7. runtime correctness, latency, memory, and strategy-sanity gates.

A candidate that improves one matchup by weakening another is recorded as an experiment, not promoted.

Data and artifact policy

Generated and local-only data must stay out of Git:

  • trained blueprints and checkpoints;
  • engine/runs/ evaluation output;
  • SQLite databases;
  • hand logs;
  • virtual environments and node_modules;
  • CMake output and frontend dist;
  • secrets and .env files.

If a model must be distributed, publish it through a separate artifact store with its metadata, engine revision, checksums, and evaluation report.

Additional documentation

License

No open-source license is currently granted. Public source availability does not by itself grant permission to copy, modify, or redistribute the code.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages


Back | FazBrowse Home | New Git URL