# Klondike winnability dataset — klondikesolitaire.com

Solver verdicts for 4,000 Turn 1 (draw-one) and 4,000 Turn 3 (draw-three) Klondike
deals, produced for the article
[How many Klondike games can you actually win?](https://klondikesolitaire.com/blog/how-many-klondike-solitaire-games-are-winnable/).

## Files

| File | Contents |
|---|---|
| `turn1.jsonl` | one line per draw-one deal |
| `turn3.jsonl` | one line per draw-three deal |
| `summary.json` | aggregate shares and 95% Wilson intervals (`node scripts/winnability/summarize.mjs`) |
| `verify-turn1.jsonl`, `verify-turn3.jsonl` | one line per full-solver win: its winning line replayed under the game's rules (`npm run winnability:verify`) |

Fields per line:

| Field | Meaning |
|---|---|
| `seed` | `study-<draw>-<n>`; the deal is `shuffledDeckOrder(seed)` from `src/solver.ts` — the exact shuffle the game uses, so every deal can be replayed |
| `draw` | 1 or 3 |
| `budget` | node budget of the full-rules search |
| `worryBack` | cards may move from foundations back to the tableau |
| `ingame` | `true` if the in-game prover (`src/solver.ts`, 100,000 nodes, whole-run moves only) already found a win |
| `verdict` | `win` (a winning line was found), `lose` (the whole reachable state space was searched without one), `unresolved` (budget ran out) |
| `nodes` | states expanded by the full-rules search (0 when `ingame`) |
| `lineLength` | moves in the winning line found by the full search — not the shortest line; `null` otherwise |
| `maxFoundation` | most cards on the foundations in any state explored (52 for wins) |
| `ms` | wall-clock time on one thread |

Fields per `verify-*` line: `seed`, `ok` (the replay reached 52 cards on the
foundations using only legal player moves), `actions` (player actions the line
took: card moves plus stock clicks), `solverMoves` (solver moves before expansion),
`reason` (why it failed, if it did), `ms`. All 1,948 full-solver wins verified.

## Rules

"Thoughtful" Klondike: the solver sees every card, including face-down ones. Standard
Klondike otherwise, matching Blake & Gent's standard rules so the figures can be
compared with theirs:

- 7 tableau piles of 1–7 cards, top card face up; 24-card stock.
- Draw 1 or 3, **unlimited redeals**.
- Build down in alternating colours; only kings (or runs headed by a king) into empty
  columns.
- Whole face-up runs may move; a partial run may move only when the card it uncovers
  can go straight to its foundation (their Theorem 4 dominance).
- Cards may move back from the foundations ("worrying back").
- Safe foundation moves are played automatically (their Theorem 1); with draw 1 the
  stock counts as a reserve for this.

## Reproduce

```
npm run winnability -- --draw 1 --count 4000 --budget 500000 --out public/data/winnability/turn1.jsonl
npm run winnability -- --draw 3 --count 4000 --budget 500000 --out public/data/winnability/turn3.jsonl
node scripts/winnability/summarize.mjs public/data/winnability/turn1.jsonl public/data/winnability/turn3.jsonl
```

Results are deterministic for a given seed and budget. Solver: `scripts/winnability/solver-full.ts`;
replay checker, written separately from the solver: `scripts/winnability/replay.ts`.

## Reference

Charlie Blake and Ian P. Gent, "The Winnability of Klondike Solitaire and Many Other
Patience Games", *Journal of Artificial Intelligence Research* 85 (2026), article 21;
arXiv:1906.12314. One million deals each; thoughtful Klondike with unlimited redeals:
draw 1 90.480 ± 0.116%, draw 3 81.945 ± 0.084%.

## License

Data: CC BY 4.0 — credit "klondikesolitaire.com". Code: same as this repository.
