Autonomous Poker Bot

Research-grade poker AI with a modular engine, ML pipeline, and data tooling. The system combines fast hand evaluation, rule-consistent game flow, and neural/heuristic policy heads with opponent-aware features.

Python
PyTorch
scikit-learn
PostgreSQL
FastAPI

Poker Bot Demo

Project Overview

The engine implements legal action validation, street progression, blind posting, and pot tracking. The evaluator supports hand ranking and equity proxies with correctness-focused tests. The ML layer offers both a lightweight RandomForest baseline and a PyTorch MLP with a sizing head.

Key Features

  • Rule-consistent game flow (preflop → showdown) with action validation
  • Fast 5–7 card evaluation with duplicate-card detection and kicker tie-breaks
  • Neural and classic ML predictors with legal-action masking
  • Hand history parsing and feature extraction for training datasets
  • Extensive tests: unit, integration, and scenario-based

How I Built It

Core in Python. PyTorch for neural models; scikit-learn for the baseline. SQLAlchemy schemas for data storage. Tests via pytest. The code emphasizes clarity, correctness, and forward-compatibility in data schemas and APIs.

What I Learned

  • When to play perfect math vs. exploiting weak players
  • Processing millions of poker hands without crashing servers
  • Making split-second decisions under pressure
  • Managing poker variance to stay profitable long-term

Results

  • Test suite: 100 passed
  • Recent engine fixes: raise semantics, betting-round completion, total pot tracking
  • Evaluator upgrades: suit handling (int/char), preflop strength heuristic, compare helper
  • ML robustness: tensor/ndarray inputs, zero-amount safety fallback, class-prob alignment
  • Data pipeline: flexible GameContext, resilient hero/action extraction

Project Stats

DurationOngoing
Lines of Code (tracked)~7,250 total
StatusGreen

Technologies

Machine Learning

PyTorch
scikit-learn
NumPy

Engine & Data

Python
PostgreSQL
Redis

Tooling

Docker
JavaScript
SQL

Performance Metrics

Eval speed (unit)~3000 evals/s (test)
Decision latencysub-50ms target
Reliability100/100 tests