This poker AI runs on Python, self-play, and mild regret
It provides an open-source Python framework to train and battle Texas Hold'em AI using counterfactual regret minimisation.

What it does
poker_ai is a Python research toolkit for training Texas Hold’em agents via Monte Carlo Counterfactual Regret Minimisation. It bundles a deterministic poker engine, state-based game traversal, and clustering logic to compress the vast card-combination space into something tractable. Once trained, you can face the agent in a terminal interface or inspect its decisions through a live web visualisation server.
The interesting bit
The project treats the game as a recursive state machine where every legal action spawns a new ShortDeckPokerState, making self-play and regret calculation straightforward to implement. Because a single player’s river combinations can exceed 56 billion, the authors use lossy and lossless clustering to shrink information sets—though, for now, this is hard-wired to a 20-card deck.
Key highlights
- MCCFR training via iterative self-play that adjusts strategy based on accumulated regret.
- A deterministic poker engine (
PokerEngine,PokerTable,Pot) for managing rounds and replaying scenarios. - A terminal runner to play against trained agents and a web-based
PokerPlotvisualiser for debugging game states. - A CLI that handles clustering lookup tables, training sessions, and resuming previous runs.
- Explicitly framed as a Python prototype, with a roadmap pointing toward a future C++ rewrite for performance.
Caveats
- Only a 20-card deck is currently supported without modification.
- The repo structure describes the
aimodule as “stub functions” and the general poker code as a work in progress. - The web visualisation and several other components are still under active development.
Verdict
Researchers and hobbyists interested in imperfect-information game theory will find a useful sandbox here; anyone expecting a production-grade, full-deck poker bot ready to clean up online should look elsewhere.
Frequently asked
- What is fedden/poker_ai?
- It provides an open-source Python framework to train and battle Texas Hold'em AI using counterfactual regret minimisation.
- Is poker_ai open source?
- Yes — fedden/poker_ai is an open-source project tracked on heatdrop.
- What language is poker_ai written in?
- fedden/poker_ai is primarily written in Python.
- How popular is poker_ai?
- fedden/poker_ai has 1.6k stars on GitHub.
- Where can I find poker_ai?
- fedden/poker_ai is on GitHub at https://github.com/fedden/poker_ai.