The Winnability of Klondike and Many Other Single-Player Card Games

Charlie Blake, Ian P. GentarXiv 2019

Introduction

Despite being played hundreds of millions of times daily, the basic mathematical properties of Klondike Solitaire—the version popularized by Microsoft Windows—have remained surprisingly elusive. Mathematicians, including Persi Diaconis, have famously referred to our ignorance of Klondike’s winnability as "one of the embarrassments of applied mathematics." The challenge lies in the massive search space and the intricate variety of rules across different "patience" games.

Historically, calculating these odds was the catalyst for the Monte Carlo method, invented by Stanislaw Ulam in 1946 while he was attempting to determine the winnability of Canfield Solitaire. This research presents Solvitaire, a general-purpose AI solver that provides the most precise realization of Ulam's vision to date.

The Solvitaire Framework

Previous attempts to calculate winnability usually relied on solvers hard-coded for a specific game. Solvitaire breaks this mold by using a flexible rule-description language (JSON), allowing a single engine to solve 73 variants of 35 different games. The solver is based on a depth-first backtracking search, enhanced by several key AI optimizations:

  • Transposition Tables: A cache that stores previously visited game states to avoid redundant computation.
  • Symmetry Breaking: The solver recognizes when different tableau piles are functionally identical, preventing it from exploring the same position multiple times.
  • Dominances: These are mathematically proven "safe moves." For instance, if moving a card to the foundation cannot possibly block a future winning move, Solvitaire executes it automatically.
  • Smart Streamliners: These heuristics prioritize promising paths, running a fast streamlined search first and only falling back to a full search if necessary.
The layout of a standard Solitaire game, illustrating the Tableau, Foundations, and Stock/Waste areas used by the Solvitaire engine.

Experimental Methodology

The researchers generated game instances using the Mersenne Twister (mt19337) pseudo-random number generator. The scale of the experiment was massive, consuming approximately 30 years of CPU time to test millions of individual runs. The study covered a broad spectrum of games, including Klondike, Canfield, FreeCell, Spider, and Golf. The resulting data has been released publicly on Figshare to facilitate further research.

Key Results and Statistical Precision

The study provides the most accurate winnability percentages ever recorded for several major games. Most notably, the winnability of "thoughtful" Klondike (where the player knows the position of all cards) was calculated to be 81.945% ± 0.084%. This represents a 30-fold increase in precision over previous estimates.

Winnability percentages and 95% confidence intervals for various Solitaire games as calculated by Solvitaire.

Other significant findings include:

  • FreeCell: Found to be nearly always winnable at 99.998881%.
  • Canfield: Calculated at 71.245%.
  • Rule Interactions: The authors discovered that rules do not just add up; they multiply. In Klondike, restricting spaces to Kings only reduces winnability slightly, but when combined with other restrictions, the winnability drops precipitously.

Limitations and Future Directions

While Solvitaire is a significant leap forward, some challenges remain. The current study focuses on "thoughtful" variants where all card positions are known. In standard play with face-down cards, winnability is lower because the player lacks perfect information. Additionally, the current rule language cannot yet describe games involving "pairing" (like Doublets). Future work may involve integrating advanced automated reasoning, such as constraint satisfaction, to prevent the solver from entering "rabbit holes" in games with liberal movement rules but strict space restrictions.

Summary updated

BibTeX
@misc{blake2019winnability,
  author = {Charlie Blake and Ian P. Gent},
  title = {{The Winnability of Klondike and Many Other Single-Player Card Games}},
  year = {2019},
  eprint = {1906.12314},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.12314},
}
Figure