Yahtzee
Yahtzee (1956) is a classic dice game where players roll five dice up to three times per turn, trying to make various scoring combinations. The player with the highest total score after 13 rounds wins.
Theory
This solver computes optimal dice-keeping decisions using dynamic programming with precomputed expected values. The approach models Yahtzee as a Markov Decision Process and achieves an expected score of ~229.64 points per game.
Game State
The game state tracks which of the 13 scoring categories have been filled, represented as a 13-bit integer. This gives possible game states. For each state, we precompute the expected value of optimal play from that point forward using backward induction.
Dice Representation
A dice configuration is represented as a count vector where is the number of dice showing face . This order-invariant representation reduces the state space from permutations to just multisets.
The Bellman Equation
Let be the expected value of game state (which categories remain). For a single turn with dice and rolls remaining:
Base case (no rolls left):
Recursive case:
The key insight is that when choosing which category to score, we consider not just the immediate points but the future expected value of the resulting game state.
Precomputation
Expected values for all 8,192 game states are precomputed offline via backward induction, starting from terminal states (all categories filled) and working backward. This table is loaded at runtime, making real-time optimal play computationally feasible.
Simplifications
To keep the state space tractable, we do not track progress toward the 35-point upper section bonus. Tracking this would multiply states by ~64x (for each possible upper score from 0-63). The precomputed values still achieve near-optimal play in practice.
Probability Reference
Single Roll Probabilities
| Outcome | Probability | Ways / Total |
|---|---|---|
| Yahtzee (5 of a kind) | 0.08% | 6 / 7776 |
| Large Straight | 1.54% | 240 / 7776 |
| Four of a Kind | 1.93% | 150 / 7776 |
| Full House | 3.86% | 300 / 7776 |
| Small Straight | 12.35% | ~960 / 7776 |
Three-Roll Probabilities (Optimal Play)
Starting from a random roll and playing optimally:
| Outcome | Probability |
|---|---|
| Yahtzee | ~4.6% |
| Large Straight | ~16.1% |
| Small Straight | ~45.3% |
| Full House | ~38.4% |
| Four of a Kind | ~20.2% |
| Three of a Kind | ~94.5% |