› Game Theory Simulator Back
Mathematical Sciences

Game Theory Simulator

Edit the payoff matrix of 2×2 games such as the prisoner's dilemma, stag hunt and chicken to find pure-strategy Nash equilibria and Pareto optimality, and visualise the cooperation rate x_C over time with replicator dynamics in real time.

Game Presets
Payoff Matrix (Row: P1, Col: P2)
P2: Cooperate (C)P2: Defect (D)
P1: Cooperate (C) / /
P1: Defect (D) / /
Replicator Dynamics
Initial cooperation rate x₀50%
Animation speed1.0×
Results
—
Nash equilibrium
—
Equilibrium payoff (P1, P2)
—
Cooperation rate x_C
—
Is the equilibrium Pareto optimal?
P1 best response
P2 best response
Nash equilibrium
Cooperation rate x_C(t)
Payoff Matrix, Best Responses and Nash Equilibria
Theory & Key Formulas
For any player $i$ and strategy $s_i'$:
$u_i(s_i^{*}, s_{-i}^{*}) \geq u_i(s_i', s_{-i}^{*})$

Replicator equation:
$\dot{x}_i = x_i(f_i - \bar{f})$

This tool (two strategies, symmetric game; $a$ is P1's payoff):
$\dot{x} = x(1-x)(f_C - f_D)$, $f_C = x\,a_{CC} + (1-x)\,a_{CD}$, $f_D = x\,a_{DC} + (1-x)\,a_{DD}$

What Is the Game Theory Simulator?

🙋
How do I find a "Nash equilibrium" with this simulator? Do I just play with the numbers in the payoff matrix?
🎓
Roughly speaking, an equilibrium is a state in which nobody wants to change their strategy. In this tool, first choose a preset such as "Prisoner's Dilemma" at the top left, then click the numbers in the payoff matrix and change them. For example, if you raise the (C, C) payoff in the prisoner's dilemma from 3 / 3 to 6 / 6, you can see the moment when (C, C) also becomes an equilibrium in addition to (D, D) (it becomes the same structure as the stag hunt). In practice, these numbers are adjusted in price-competition models to explore equilibrium prices.
🙋
But that's a static analysis, isn't it? What is the moving "Cooperation rate x_C(t)" graph on the right showing?
🎓
Good question. The graph on the right is replicator dynamics: it shows how the share x of cooperators in a population changes over time under the rule that strategies doing better than average grow. Change the "Initial cooperation rate x₀" and press "Reset" → "Start". You can see the conditions under which cooperation spreads and those under which defection spreads. It is a basic model for thinking about animal group behaviour and the spread of social norms.
🙋
In the prisoner's dilemma, even with an initial cooperation rate of 90%, the cooperation rate kept falling towards 0%… Is that what makes the "prisoner's dilemma" so scary?
🎓
Exactly! You have seen with your own eyes the paradox in which individually rational choices lead the group to a bad outcome. Defection is a dominant strategy that pays off whatever the other player does, so cooperation disappears wherever you start. But switch to the "Stag Hunt": if the initial cooperation rate is above 50% it goes to 100% cooperation, and below 50% it goes to 0%. The initial conditions change which equilibrium is reached. You get an intuitive feel for how the structure of the game (the payoff matrix) decides where the population ends up. Competition between technical standards (like VHS versus Betamax) is sometimes explained with such multiple-equilibrium models.

Frequently Asked Questions

Because some games have no pure-strategy Nash equilibrium. In matching pennies ((C, C) and (D, D) are (1, −1), (C, D) and (D, C) are (−1, 1)), for example, in every cell one player gains by switching, so there is no pure-strategy equilibrium, only the mixed-strategy equilibrium in which both choose C and D with probability 1/2 each. This tool judges only pure-strategy equilibria and says so when none exists. Note that the chicken game has two pure-strategy equilibria, (C, D) and (D, C).
Set it with the "Initial cooperation rate x₀" slider (0–100%), press "Reset" and then "Start". With the preset payoffs, the prisoner's dilemma goes to 0% wherever it starts; the stag hunt goes to 100% or 0% depending on whether it starts above or below 50%; chicken goes to 50%; and the coordination game goes to 100% or 0% with 1/3 as the boundary. Changing x₀ on either side of the boundary makes the difference in where it ends up very clear.
In the graph on the right, the horizontal axis is time and the vertical axis is the population's cooperation rate x_C (0 to 1). If the line sticks to 0 or 1, one strategy has taken over the population; if it settles at an intermediate value, the two strategies coexist (50% in chicken). In the matrix on the left, blue dots are P1's best responses and red dots are P2's best responses, and a cell with both is a Nash equilibrium (NE).
A Nash equilibrium depends on the order (relative size) of the payoffs, so changing the absolute values does not change the equilibrium as long as the ranking stays the same. In the prisoner's dilemma, for example, the equilibrium does not change as long as defecting always pays more than cooperating. The judgement updates as soon as you enter a payoff (you can also re-judge with the "Find Nash Equilibria" button).

Real-World Applications

Economics and business strategy:Price and advertising competition between companies is modelled to predict the market price as a Nash equilibrium. It is used to analyse how the strategies of new entrants or collusion between incumbents (cartels) upset the equilibrium.

Biology and ecology:Animal behaviour (territorial fights, food sharing, breeding strategies) is studied as "evolutionarily stable strategies (ESS)". For example, one can simulate in what proportions hawk and dove strategies coexist in a population.

Political science and international relations:Arms races, international negotiations and compliance with environmental treaties are analysed as the "prisoner's dilemma" or the "chicken game". It is used to examine how mutual distrust produces non-cooperative equilibria and to design institutions that escape them.

Computer science and network design:The behaviour of users (or protocols) in data transfer on the Internet is modelled as a game. An example is the analysis of "congestion games", in which each node acting to maximise its own efficiency causes congestion across the whole network.

Common Misconceptions and Points to Note

First, dropthe assumption that "a Nash equilibrium is the one 'right answer'". In the "Stag Hunt", for example, there are two Nash equilibria: "everyone cooperates" and "everyone defects". Changing the initial state in the simulator can change which equilibrium is reached. This shows that, in real negotiations and markets too, different equilibria can be realised depending on initial conditions and history (for example, which technology spread first).

Next,the assumptions of replicator dynamics. This model uses a simple imitation rule — "strategies that do better than average grow in proportion to the difference" — and assumes random encounters in a large population. This tool also assumes a symmetric game and uses only P1's payoffs (the left number in each cell), so for games where the two players' positions differ, such as the "Battle of the Sexes", the dynamics are only a guide from P1's point of view. When applying it in practice, think carefully about whether the way the target system learns and imitates fits these assumptions.

Finally,the "order" of the numbers in the payoff matrix matters more than their "absolute values". In the prisoner's dilemma, the temptation payoff for defecting T, the reward for cooperating R, the punishment for mutual defection P and the sucker's payoff for lone cooperation S satisfyT > R > P > S . Even if you multiply all payoffs by 10 in the simulator (T=50, R=30, P=10, S=0), as long as this order is preserved the prisoner's dilemma still holds and defection still dominates. When changing the numbers, watch how this order changes.

How to Use

  1. Choose a preset (Prisoner's Dilemma, Stag Hunt, Chicken, Battle of the Sexes, Coordination) or enter "P1 payoff / P2 payoff" in each cell of the payoff matrix
  2. The pure-strategy Nash equilibria, equilibrium payoffs and whether they are Pareto optimal are shown immediately, and the matrix in the figure marks each player's best responses and the equilibrium cells (NE)
  3. Set the "Initial cooperation rate x₀" and press "Reset" → "Start" to draw the time evolution of the cooperation rate x_C under replicator dynamics in the graph on the right. "Animation speed" changes how fast it advances
  4. Press "Stop" to halt the animation and check how the equilibria change as you edit the payoffs

Worked Example

Prisoner's dilemma (preset): (C, C) = (3, 3), (C, D) = (0, 5), (D, C) = (5, 0), (D, D) = (1, 1). P1's best response is D if the opponent plays C (5 > 3) and also D if the opponent plays D (1 > 0), so defection is a dominant strategy; the Nash equilibrium is (D, D) with payoff (1, 1). Both players would be better off at (C, C) with (3, 3), so this equilibrium is not Pareto optimal. Even from an initial cooperation rate of 90%, the replicator dynamics drive the cooperation rate steadily towards 0%. Switching to the stag hunt gives two equilibria, (C, C) and (D, D); with x₀ = 60% it goes to 100% cooperation and with 40% to 0%.

Practical Notes

  1. When payoffs are set in money, future payoffs in a repeated relationship need to be discounted (this tool handles one-shot games)
  2. Replicator dynamics are an average model assuming random encounters in a large population. Results may differ for small populations or when individuals interact only with their neighbours
  3. When there are several Nash equilibria, which one is realised depends strongly on the initial conditions. Check by changing x₀ on either side of the boundary
  4. In structures whose only equilibria are not Pareto optimal (such as the prisoner's dilemma), mechanisms that change the payoffs themselves — contracts, penalties, reputation — are the key to drawing out cooperation