🃏 Texas Hold'em Poker

Strategic Analysis with ODE-Based Value Computation

Pot: $0
Waiting
Player 0 (You)
$1000
Player 1
$1000
Player 2
$1000
Player 3
$1000
Player 4
$1000

Game State

No game in progress

Event History

No events yet

Strategic Analysis

ODE analysis will appear here

🔧 go-pflow Concepts in This Demo

Learn how this poker game models complex game state using Petri nets

Texas Hold'em flows through distinct betting rounds, modeled as places:

  • waiting - Before hand starts
  • preflop - After hole cards dealt
  • flop - After 3 community cards
  • turn_round - After 4th card
  • river - After 5th card
  • showdown - Final comparison
How Transitions Work

Transitions like deal_flop move a token from preflop to flop, but only when all betting is complete.

Each player's turn is tracked with dedicated places:

  • p0_turn - Player 0's turn to act
  • p0_active - Player 0 still in hand

When a player acts (fold/check/call/raise), their turn token moves to the next player:

p0_turn →(p0_raise)→ p1_turn
Eliminating Players

When a player folds, tokens are removed from both pN_turn and pN_active, preventing them from acting again this hand.

Certain transitions require specific roles to fire:

  • dealer - Can deal cards, determine winner
  • admin - Can end hand, override game state
Guard Conditions

Beyond roles, transitions can have guards—conditions that must be true:

p0_raise: guard = "chips[0] >= current_bet"

This ensures a player can only raise if they have enough chips.

The go-pflow library computes hand strength using ODE simulation:

  1. Model each possible hand (pair, flush, etc.) as a place
  2. Connect transitions for card combinations that make each hand
  3. Run ODE to compute probability flow to each hand type
  4. Combine into an overall hand strength score
Strategic Value

The "Strategic Analysis" panel shows computed values for each action based on:

  • Current hand strength
  • Potential to improve (outs)
  • Position relative to other players
  • Pot odds and implied odds

Every action creates an immutable event stored in order:

{type: "HandStarted", dealer: 2, blinds: [50, 100]} {type: "FlopDealt", cards: ["Ah", "Kd", "7c"]} {type: "P0Raised", amount: 200} {type: "P1Called", amount: 200}
Benefits
  • Replay: Reconstruct any point in the game
  • Audit: Verify all actions were legal
  • Undo: Roll back to previous state
  • Analysis: Study betting patterns