CFR Poker Agent

Counterfactual Regret Minimization (CFR+) Nash equilibrium imperfect information reinforcement learning MCTS

Goal

A poker agent for two-player Limit Texas Hold'em that learns robust, mixed strategies through offline Counterfactual Regret Minimization (CFR+) and executes them at runtime via a precomputed lookup table for near-instant decision-making.

The Problem

Poker is a fundamentally challenging AI domain because it involves imperfect information, stochastic outcomes, and adversarial opponents—unlike games like chess, where all states are visible. Building a competitive agent requires reasoning about hidden cards, balancing aggressive and conservative play, and avoiding predictable, exploitable patterns. A hard-coded rule-based agent is brittle, while a full game-tree search is computationally infeasible under the tournament's strict per-action time limit (~0.38 seconds). We needed an agent that could learn strategic depth offline and deploy lightning-fast decisions online.

Methodology

We broke down the project into five stages:

1. State Abstraction

2. Hand Strength Estimation

3. CFR+ Training

4. Strategy Extraction and Deployment

5. Baseline Comparison with MCTS

Results

  • The CFR+ agent achieved a 90% win rate against a random baseline and a 90% win rate against an aggressive raise-always opponent, showing the learned strategy captures meaningful poker decision-making beyond chance or simple heuristics.
  • In a 100-match head-to-head against an MCTS baseline, CFR+ won 49% of matches while MCTS won 51%, but CFR+ maintained a positive average profit of +3.6 chips per game versus MCTS at −3.6—demonstrating superior chip extraction and loss minimization.
  • The agent progressed from an ultra-passive early version (95% call rate) to a refined 352-state context-aware strategy, placing 7th in a class tournament of 20+ agents.
  • The MCTS baseline's best version (V10) achieved 79.6% win rate in controlled testing but overfitted against unseen opponents, confirming CFR+'s equilibrium-seeking approach produces more robust play.

Visual Results

Agent Win Rates
Figure 1: Win rates across different agent variants. CFR_Improved achieved 90%, matching the best performing MCTS variant (MC-PotOdds+SPR at 92%).

Average Profit per Game
Figure 2: Average profit per game across agent variants. CFR_Improved achieved +5.0 chips per game, outperforming all MCTS variants.