Kit & tools

What's in the zip you downloaded, and which script does what.

The starter kit for nlhe-hu-v2 is a self-contained Python package: the server's own simulation code plus examples and tools. Everything the server does, you can reproduce locally.

starter kit

An archive with the environment, agent examples, and specifications — everything you need to get started and train your agent locally.

nlhe-hu-v2.zip

Install

Python 3.10+. From the unzipped kit:

pip install -e ".[train]"

The [train] extra adds PyTorch. Without it, you can still play, check, and evaluate — just not train with the example scripts.

Layout

pathpurpose
proxypoker/the server's simulation code — do not edit. Includes agent_file.py (save/load) and contract.json
proxypoker/players.pyNetworkPlayer (how an uploaded file plays), CallingStation, RandomPlayer, EquityBot
examples/01_play_bots.pythe API by example: matches, a narrated hand, a hand-written bot, the 180 inputs
examples/02_clone_equity_bot.pyimitation learning: copy a bot's buttons, export, check
examples/03_selfplay_ppo.pyreinforcement learning (PPO) against bots and frozen copies of itself
examples/04_parallel_train.pya full run on a many-core machine: imitation then PPO, checkpoints, --resume, --hours
examples/export_npz.pyPolicyNet (the server's network shape in PyTorch) and export()
baselines/baseline.npzthe free trained starting agent
tools/check_agent.pythe server's checks locally: format, limits, admission match, warnings
tools/play.pyplay a bot or an agent yourself in the terminal
tools/evaluate.pyduplicate matches against bots or another agent, with error bars; --jobs for more cores

The player API

A player is anything with:

class MyPlayer:
    def make(self, rng) -> "Decider": ...

class Decider:
    def decide(self, view) -> Action: ...
  • make(rng) is called once per hand with that hand's random stream.
  • view is a proxypoker.engine.View — what the acting seat is allowed to see.
  • Return a proxypoker.engine.Action.

Three helpers in proxypoker.interface:

  • observe(view) → the 180-vector your network reads.
  • legal_mask(view) → the 6 legal-button mask.
  • to_action(view, button) → convert a button index into a legal Action (handles min-raise, all-in capping).

Run a match:

from proxypoker.match import play_match
from proxypoker.rules import Rules

rules = Rules.default()           # the nlhe-hu-v2 config
result = play_match({"a": p1, "b": p2}, rules, seed=123)

Three tools you'll use often

tools/play.py — play an agent or bot from the terminal. --duplicate replays each deal from the other seat later (with suits renamed so you can't recognize them), so the score reflects decisions, not card luck.

python tools/play.py baselines/baseline.npz --duplicate

tools/check_agent.py — the server's admission, locally.

python tools/check_agent.py my_agent.npz
python tools/check_agent.py my_agent.npz --api https://proxy.example.com   # also verify contract digest

tools/evaluate.py — many matches with error bars.

# vs the baseline, 5000 deals, 8 cores
python tools/evaluate.py my_agent.npz --vs baselines/baseline.npz --deals 5000 --jobs 8

# vs a specific built-in bot
python tools/evaluate.py my_agent.npz --vs EquityBot --deals 3000 --jobs 8

The output's last line is +X ± Y bb/100. Trust differences only when |X| > Y. More deals = tighter Y.