Opponent Hand Estimation in the Game of Gin Rummy

Peter E. Francis, Hoang A. Just, Todd W. NellerAAAI 2021 · DOI

Abstract

Opponent hand estimation in Gin Rummy presents a significant challenge due to the imperfect information and sparse data signals inherent in the game. Researchers at Gettysburg College explored three computational strategies—Bayesian estimation, a Simple Neural Network, and a specialized Convolutional Neural Network (CNN)—to predict hidden hands. By leveraging suit-invariant representations through "ambi-superpermutations," the study demonstrates that a specialized CNN can provide a 5% win-rate advantage over baseline players, suggesting that optimal estimation is phase-dependent.

Introduction

Gin Rummy is a classic two-player card game defined by hidden information. Unlike Poker, where betting patterns offer strong signals, Gin Rummy provides only sparse data: the cards an opponent discards or draws from the open pile. Accurate estimation of the opponent's 10-card hand is critical for avoiding "melds" (sets or sequences) and determining when to "knock" to end a round based on the opponent's "deadwood" (unmatched cards). This research seeks to bridge the gap in AI for Gin Rummy by developing data-driven estimation models.

Methods

The study evaluates three distinct approaches trained on 10,000 simulated games:

Bayesian Estimation

This model uses Bayes’ Rule to update the probability of an opponent holding specific cards based on observed game events. It employs "rational symmetry" to ensure the model remains invariant to specific suits, focusing instead on the logical relationships between cards.

Simple Neural Network

A four-layer dense network was developed to process the current probability distribution alongside the most recent game actions. These actions are one-hot encoded (OHE) to represent discarded and face-up cards.

Input vector representation for the Simple Neural Network model, showing the encoding of probability distributions and game actions.

Shankar CNN

The most novel contribution is the Shankar CNN, which incorporates "Shankar’s Plug Rule"—a set of logical conditions for identifying safe cards. To handle the 4x13 card grid effectively, the authors introduced "ambi-superpermutations." This mathematical sequence allows for a 17x13 array representation that is invariant to suit permutations, enabling the CNN to recognize patterns regardless of how suits are ordered without requiring massive data augmentation.

Key Results

The models were evaluated across 50,000 games using metrics such as Mean Squared Difference (MSD) and Drift Area. A primary finding is that estimator performance is highly dependent on the game phase.

Mean Squared Difference across game turns, illustrating the phase-dependent accuracy of the Bayesian, Simple NN, and Shankar CNN models.
  • Phase Performance: The Simple NN and Bayesian models excel in the early game (turns 1-3). The Shankar CNN dominates the mid-game (turns 10-28), while the Bayesian model regains a slight edge in the extreme endgame.
  • Win Rate: A player utilizing the Shankar CNN for discard decisions achieved a 55% win rate against a baseline player, representing a statistically significant 5% edge in competitive play.

Discussion and Future Work

The results suggest that no single model is optimal for the entire duration of a Gin Rummy match. Consequently, the authors recommend an ensemble approach: utilizing a Simple NN for the first 9 turns, transitioning to the Shankar CNN for the middle phase, and reverting to the Bayesian or CNN model for the final turns.

Limitations of the current study include the use of "simple" simulated opponents who do not employ deceptive tactics like baiting. Future research could focus on adapting these models to dynamic human playstyles and applying hand estimation to more complex strategic decisions, such as knocking or blocking opponent draws.

Summary updated

BibTeX
@inproceedings{francis2021opponent,
  author = {Peter E. Francis and Hoang A. Just and Todd W. Neller},
  title = {{Opponent Hand Estimation in the Game of Gin Rummy}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2021},
  doi = {10.1609/aaai.v35i17.17824},
}
Figure