How to use the zero-sum game solver
- Enter the payoff matrix, one row per line. Each number is what the row player wins (and the column player loses) for that pair of choices.
- Use negative numbers for a loss of the row player. Up to 8 rows and 8 columns.
- Read the value of the game and whether there is a saddle point.
- Read the best mix of choices for each player, as probabilities and percentages.
Formula
Row player picks probabilities x to maximize v such that the expected payoff of x against every column is at least v
Column player picks probabilities y to minimize v such that the expected payoff of every row against y is at most v
Minimax theorem: both reach the same value v, the value of the game
Saddle point: an entry that is the smallest in its row and the largest in its column; then v is that entry
The problem is solved as a linear program with the simplex method after shifting all payoffs to be positive. The value is shifted back at the end.
Matching pennies, a saddle point and a mixed game
Matching pennies, with rows (1, -1) and (-1, 1), is fair: the value is 0 and each player picks each side half of the time. Rock, paper, scissors, with rows (0, -1, 1), (1, 0, -1), (-1, 1, 0), also has value 0 and the best strategy is one third for each of the three choices.
The matrix with rows (3, 2, 4), (1, 0, 5), (6, 2, 3) has a saddle point: the entry 2 is the smallest in rows 1 and 3 and the largest in column 2, so the value is 2 with pure strategies. The matrix with rows (2, -1, 3) and (-2, 4, -1) has no saddle point; the row player mixes, the column player mixes, and the value is 2/3, or 0.66666667.
What the answer means
The value is what the row player can guarantee on average, however the other side plays, and also the most the column player has to give up if both play well. A positive value favors the row player, a negative one the column player, and 0 means a fair game. If you play the best mix and your opponent plays anything else, you do at least as well as the value.
A mixed strategy means choosing at random with fixed odds. It matters when any single choice can be exploited. The page also checks for a saddle point first: if the largest row minimum equals the smallest column maximum, a pure choice is best for both and no randomizing is needed.
Limits of the model
The model assumes what one player wins the other loses, both play once with full knowledge of the payoffs, and both choose at the same time. Real games often add cooperation, repeated play or hidden information, which change the answer. Optimal mixes are not always unique, so another program may show a different pair of strategies with the same value.
For another kind of two-player game, try the Nim game solver. To weigh options against criteria, use the decision matrix calculator, and to find the average result of a set of chances, use the expected value calculator.
Assumptions and limits
- The game has two players and the payoffs sum to zero.
- The matrix is at most 8 by 8 with real number entries.
- The page shows one pair of optimal strategies; others may exist.
- Probabilities are rounded to 6 significant digits.
Frequently asked questions
What is a zero-sum game?
A game in which one player's gain is exactly the other player's loss, so the payoffs add up to zero.
What is a saddle point?
An entry that is the lowest in its row and the highest in its column. When one exists, both players are best off always choosing its row and column.
What is a mixed strategy?
A random choice among options with set probabilities, used so that the opponent cannot exploit a pattern.
Why is the value of rock, paper, scissors 0?
The game is symmetric, so neither side can do better than break even against a best reply.