A prisoner's dilemma calculator analyzes a two-player game with two choices each. Enter the payoffs for the four cases, and the calculator finds the Nash equilibria, the dominant strategy of each player, whether the game is a prisoner's dilemma, and which outcome has the highest combined payoff. It uses the standard payoff conditions and works for any two-by-two game, including coordination games. Everything is computed in your browser.
How to use the prisoner's dilemma calculator
- Enter the row player's and the column player's payoff for each of the four cases.
- Use bigger numbers for better outcomes, and negative numbers for losses such as years in prison.
- Press Analyze.
The payoffs of the prisoner's dilemma
The Wikipedia article on the prisoner's dilemma gives the canonical matrix with four payoffs. R is the reward for mutual cooperation, P is the punishment for mutual defection, T is the temptation to defect against a cooperator, and S is the sucker's payoff of a cooperator against a defector.[1] The game is a prisoner's dilemma in the strong sense when T > R > P > S. For the game to be repeated and not reward alternating betrayal, the page also requires 2R > T + S.[1] The calculator checks these inequalities, and says whether they hold.
The classic example
The page describes the typical version, from Poundstone, in which two prisoners are each offered a deal. If both stay silent, each gets one year on a lesser charge. If one testifies and the other does not, the one who testifies goes free and the other serves three years. If both testify, each serves two years.[1] Entering these as negative payoffs gives −1 and −1 when both are silent, −3 and 0 when only the column player testifies, 0 and −3 when only the row player testifies, and −2 and −2 when both testify. These are the default example values.
Dominant strategies and Nash equilibrium
A strategy is strictly dominant if it gives a better outcome than every other strategy no matter what the other players do.[3] The prisoner's dilemma page says that defection always results in a better payoff than cooperation, so it is a strictly dominant strategy for both players.[1] A Nash equilibrium is a situation in which no player could gain more by changing their own strategy while the other players' strategies stay fixed.[2] The calculator checks each of the four cases: it is an equilibrium if each player's payoff is the best that the player can get given the other's choice. In the classic game, the only equilibrium is that both defect, with payoffs of −2 each, although both cooperating, at −1 each, would be better for both.
Why the dilemma is a dilemma
The puzzle is that each player, acting in their own interest, ends up with a worse result than if both had cooperated. The calculator shows this by listing the highest total payoff: both cooperating gives a total of −2, and both defecting gives a total of −4. The same pattern appears in arms races, in overuse of shared resources and in price wars. Repeated play and communication can change the outcome, which is why the 2R > T + S test matters for the repeated game.
Other two-by-two games
The calculator is not limited to the prisoner's dilemma. In a coordination game, with payoffs of 2 each when both cooperate, 1 each when both defect and 0 otherwise, there are two equilibria and no dominant strategy. There is also a mixed equilibrium, in which each player cooperates with probability 1/3, found by making the other player indifferent between the two choices. That mixed result is computed from the indifference condition, and it is an addition to the pages cited here. It is shown only when no pure strategy is dominant.
A worked example with the numbers
Use the payoffs T = 5, R = 3, P = 1 and S = 0. Enter R = 3 and 3 for mutual cooperation, S = 0 for the row player and T = 5 for the column player when only the column player defects, T = 5 for the row player and S = 0 for the column player when only the row player defects, and P = 1 and 1 for mutual defection. The calculator reports that defecting is dominant for both, that the only equilibrium is that both defect with payoffs of 1 and 1, that the game is a prisoner's dilemma, and that 2R = 6 is more than T + S = 5, so the repeated game condition holds. The highest total is 6, when both cooperate. If you change T to 10, then 2R = 6 is less than T + S = 10, and the calculator says so.
Where the model is used
The prisoner's dilemma is used in economics, political science and biology to describe situations in which individual incentives and group interests differ. Examples include two firms deciding whether to cut prices, countries deciding whether to limit emissions, and neighbours deciding whether to share the cost of a fence. The calculator gives you the equilibrium of each such game, once you have put numbers on the outcomes.
Common mistakes
- Mixing up the order of the payoffs. In each case, the row player's payoff comes first in the boxes above.
- Using years as positive numbers. More years is worse, so enter them as negative numbers.
- Expecting the best outcome as the equilibrium. In a dilemma it is not.
- Forgetting that the game needs T > R > P > S. Other orderings make different games.
What next
Use this often? Add Prisoner's D to your Home screen.
Frequently asked questions
What is a prisoner's dilemma calculator?
A tool that analyzes a two-player game with two choices each, from its payoffs, and finds the equilibria and dominant strategies.
What are the payoffs of the prisoner's dilemma?
T for the temptation to defect, R for mutual cooperation, P for mutual defection and S for the sucker's payoff, with T > R > P > S.
What is a Nash equilibrium?
A situation in which no player could gain more by changing only their own strategy while the others stay fixed.
What is a dominant strategy?
A strategy that is better than every other, whatever the other player does. In the prisoner's dilemma, defection is dominant for both players.
Why do both players defect in the dilemma?
Because defecting gives each a better payoff whatever the other does, even though mutual cooperation would leave both better off.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.