Symmetric 2x2 Evolutionary Game Simulator
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
BY Carlos Pedro Gonçalves and Carlos Rouco (2026).
Lusophone University Department of Management on Civil Aviation and Airports - School of Economic Sciences and Organizations.
The current model is a simulator of 2x2 evolutionary games with symmetric payoff matrices applying a discrete time replicator equation that can lead to chaotic dynamics in the proportion of players playing each strategy.
The payoffs are adjustable for different 2x2 symmetric games using the sliders.
Denoting by xA the proportion of players playing strategy A, xB the proportion of players playing strategy B and the payoff matrix entries by PAA, PAB, PBA and PBB. The fitness for both strategies is updated by the following rule:
fA(t) = (PAA * xA(t)) + (PAB * xB(t)) + stochastic-impact-level * z(t) fB(t) = (PBA * xA(t)) + (PBB * xB(t)) + stochastic-impact-level * (1 - z(t))
In this case, z(t) corresponds to a stochastic shock level uniformly distributed in the interval [0,1], if z(t) > 0.5 the shock increases the fitness of strategy A over that of strategy B, conversely if z(t) < 0.5 it is strategy B's fitness that is increased more than A's, if z(t) = 0.5 both strategies' fitness is increased by the same amount.
If the user sets the stochastic impact level to zero then we get a deterministic dynamics.
The mean fitness is given by:
pi-bar(t) = (xA(t) * fA(t)) + (xB(t) * fB(t))
The proportions of players playing each strategy are updated by the discrete time replicator scheme:
xA(t+1) = xA(t) + xA(t) * (fA(t) - pi-bar(t)) xB(t+1) = 1 - xA(t+1)
This replicator scheme can show different types of dynamics depending upon the payoffs, including fixed point dynamics, periodic dynamics and chaotic dynamics.
The default values of the sliders show an example that exhibits deterministic chaos, as explained in the next section.
The model is part of the Chaos Theory and Complexity Sciences' international R&D project under development at Lusophone University's Department of Management on Civil Aviation and Airports - School of Economic Sciences and Organizations:
https://sites.google.com/view/chaos-complexity/
For more Netlogo models in this project that include classroom materials used in the Mathematics I and II courses at Lusophone University's BA in Aeronautical Management (https://www.ulusofona.pt/en/lisboa/bachelor/aeronautical-management) see the Modeling Commons project link:
- 'Chaos Theory and Complexity Sciences' project https://www.modelingcommons.org/projects/190
HOW TO USE IT
The user can change the payoff matrix entries and the stochastic impact level using the sliders.
The default slider values for the model show an example of a payoff matrix value that leads to chaotic dynamics in the proportions of players playing each strategy:
PAA = 1, PAB = PBA = 6.26, PBB = 0 stochastic-impact-level = 0
This example is addressed in the following article:
Daniele Vilone, Alberto Robledo and Angel Sánchez (2011) "Chaos and unpredictability in evolutionary dynamics in discrete time" https://arxiv.org/pdf/1103.1484.
The user can control the sliders for the payoff matrix to get different game configurations plus the slider for the stochastic shock which, in the default slider values, was set to zero.
The algorithm also calculates the pure strategies' Nash equilibria for the 2x2 classical symmetric game showing it on a monitor.
The plots show the result of the evolutionary game simulation, these include:
The plot of xA, that is, the proportion of players playing strategy A (the proportion playing strategy B is just set to 1 - xA, as explained in the previous section);
A delay plot for xA.
Two additional monitors are also provided for the proportion of players playing strategy A and the proportion of players playing strategy B in a two-decimal places approximation.
We now discuss some examples that the user can try.
EXAMPLE 1: THE EVOLUTIONARY PRISONER'S DILEMMA
In this version of the game, strategy A becomes "cooperate" and B "defect", cooperation wins 3 points against a cooperating player but against a defector the cooperator gets 0 points, while a defector against a cooperator wins 5 points and against a defector wins 1 point.
This leads to the payoff matrix:
PAA = 3, PAB = 0, PBA = 5, PBB = 1.
If you simulate the game with these payoffs the defection becomes evolutionarily dominant as an attracting fixed point with all players playing defection (xA = 0, xB = 1).
EXAMPLE 2: PERIODIC DYNAMICS
In the case of the following payoff matrix, while the game has two pure strategies' Nash equilibria, the dynamics is periodic with a period 2 cycle (Vilone et al., 2011, p.4):
PAA = 1, PAB = 5, PBA = 5, PBB = 0.
While by setting the payoff matrix to the following values we get a period 4 cycle:
PAA = 1, PAB = 6, PBA = 6, PBB = 0.
If we add a small amount of noise (for instance stochastic-impact-level of 0.05) we get an intermittent dynamics that tends to occur for systems near a chaotic dynamics near onset of chaos.
EXAMPLE 3: CHAOTIC DYNAMICS
In the case of the following payoff matrix with zero noise while the game has two pure strategies' Nash equilibria, the dynamics is chaotic with some intermittency associated with the proximity to the period 4 cycle (Vilone et al., 2011, p.4):
PAA = 1, PAB = 6.26, PBA = 6.26, PBB = 0.
Another example of chaotic dynamics occurs for the following parameters with a cubic-like attractor structure, however, there is a problem here since the proportions fall outside the interval from [0,1], which can occur for this version of the discrete time replicator model (type I discretization) so the user may wish to experiment with changes to the replicator equation and see the consequences for the overall dynamics:
PAA = 4, PAB = 0, PBA = 0, PBB = 4.
The reason for the cubic-like structure can be explained from the replicator's equations.
The current simulator can be used in classroom as a way do discuss evolutionary game theory models and the type I discrete replicator equation.
Comments and Questions
globals [ xA ;; proportion playing A xB ;; proportion playing B previous-xA ;; proportion playing A in previous step used for the delay plot fA ;; fitness of A fB ;; fitness of B pi-bar ;; average population fitness equilibria ;; pure strategies Nash equilibria ] to setup clear-all set xA random-float 1 set xB 1 - xA calculate-nash reset-ticks end to calculate-nash ;; calculate pure strategies Nash equilibria for the symmetric game set equilibria [] if PAA >= PBA [set equilibria lput "(A,A)" equilibria] if PAA <= PBA and PAB >= PBB [set equilibria lput "(A,B)" equilibria set equilibria lput "(B,A)" equilibria] if PAB <= PBB [set equilibria lput "(B,B)" equilibria] end to go set previous-xA xA update-fitness apply-replicator do-plots tick end to update-fitness ;; fitness calculation let z random-float 1 set fA (PAA * xA) + (PAB * xB) + stochastic-impact-level * z set fB (PBA * xA) + (PBB * xB) + stochastic-impact-level * (1 - z) ;; mean fitness calculation set pi-bar (xA * fA) + (xB * fB) end to apply-replicator ;; update of type I discrete time replicator set xA xA + xA * (fA - pi-bar) set xB 1 - xA end to do-plots set-current-plot "Proportion of Players Playing A" plot xA set-current-plot "Delay Plot" plotxy previous-xA xA end
There is only one version of this model, created about 6 hours ago by Carlos Pedro S. Gonçalves.
Attached files
| File | Type | Description | Last updated | |
|---|---|---|---|---|
| Symmetric 2x2 Evolutionary Game Simulator.png | preview | Preview for 'Symmetric 2x2 Evolutionary Game Simulator' | about 6 hours ago, by Carlos Pedro S. Gonçalves | Download |
This model does not have any ancestors.
This model does not have any descendants.
Download this model