NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo User Community Models

(back to the NetLogo User Community Models)


by Jeff Russell (Submitted: 09/05/2007)

[screen shot]

Download Evolutionary_Game_Theory_Mayberry_ESS
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".

(You can also run this model in your browser, but we don't recommend it; details here.)


This is a simple model of two driver types on a two lane road. If a right-hand side driver meets a left-hand side driver, one driver will die. The simulation is used to help students understand the concept of Evolutionarily Stable Strategies as part of a Game Theory course via the self-directed series of questions outlined below.


PURPOSE: To gain familiarity with NetLogo, to understand the Evolutionarily Stable Strategy (ESS) equilibrium concept, and to see how ESS relates to Nash Equilibrium.

Open Mayberry and click on "setup".
You are looking at the main street that runs through a small American town.
Every day starts with people leaving their homes and driving their cars across the fields to the road so they can drive to work. Work consists of driving up and down main street. The homes are scattered around the screen. Some homes are on Main street so they do not need to drive across the fields.

Click setup.
Click go.
Click go again to stop the simulation.
If the agents are moving too fast to see what is going on, use the slider right above the "go" button to slow down the program.
The start-rts and start-lefts sliders determine the starting number of right-hand side drivers (red) and left-hand side drivers (blue). Try different settings to better understand the simulation.
If you need to return to the original settings, you can just re-open the program.

All drivers know to head towards the main road. If drivers encounter each other off the road, there are no crashes.
Once they are on the road, they drive on either the right-hand side or the left hand side. When they reach the end of the road, they turn around and head back the other way on the road.
If a left and a right driver both occupy the same patch of road, there is a head-on collision and one of the drivers will die.
If you die, your payoff is -1 and your vehicle disappears from the simulation.
If you don't die, your payoff is 0.
The Prob-left-die slider determines the probability the left driver will die in an encounter with a right driver.
1 minus this probability is the probability the right driver will die.
The initial setting of 0.5 means each driver has a 50% chance of dying.


John Nash gets up in the morning, makes his coffee, gets in his car, heads for the road.
John turns onto the road, starts driving on the right, and sees another car heading his way, driving on the "wrong" (left) side. Both drivers are travelling at a high rate of speed, so they can only move once, and they will end up moving at the same time (single shot, simultaneous move game.)
If they meet, one will die in the crash (payoff of -1).
John knows there is a 50% chance it will be John.
John's expected payoff is -0.5.
John knows the other driver has the same expected payoff.
QUESTION 1: Does this describe a Nash equilibrium? Are both drivers (players) choosing best responses to the other driver's strategy?

QUESTION 2: If John knows the other driver is also rational and is capable of calculating the necessary expected payoffs (classical game theory assumptions), what should John do, assuming both drivers move (change lanes) simultaneously? (No correct answer, this highlights the fact that Nash defines an equilibrium, yet does not say how to get there)

Assuming there is a 50% chance for each type of driver to die in a collision, the Normal form of this game is:
```````````````Drive Left`````````Drive Right
Drive Left`````0,0```````````````-0.5, -0.5
Drive Right```-0.5,-0.5```````````0,0

QUESTION 3: What are the two Nash Equilibrium?

QUESTION 4: Which Nash Equilibrium is "better" or more likely? (Again, no way to tell how to get there.)


Now we change the story to match evolutionary game theory assumptions.

Maynard Smith gets up in the morning, makes his coffee, gets in his car, drives to the road. Maynard is talking on his cell phone, eating a pop tart, tuning his radio, not paying any attention to his driving.
Maynard always drives on the right hand side, the habit is hard-wired into his actions.
Maynard turns onto the road.
Another driver, Jim Bond, is coming towards him driving on the "wrong" (left) side of the road.
Jim is drinking tea, eating a crumpet, talking to Q on his shoe phone, not paying any attention to his driving.
Jim always drives on the left hand side, the habit is hard-wired into his actions.

QUESTION 5: What will happen? Will either driver change their driving strategy?

Now, we will expand the situation so that there is a population of both right hand and left hand drivers, and then we will apply ESS concepts.

Designate the always right strategy as the incumbents. (s*)
Designate the always left strategy as the mutants (s)

Start with a large incumbent population (set start-rts at 80) and a small mutant invasion (set start-lefts at 20)

Give each driver-type the same probability of death, so set the Prob-left-die slider at 0.5

QUESTION 6: Calculate the starting expected payoffs for each driver-type:
The expected (negative) payoff for right-hand drivers is:
(prob rhs)*0 + (prob lhs)*(1-prob-left-die)
The expected (negative) payoff for left-hand drivers is:
(prob lhs)*0 + (prob rhs)*(prob-left-die)
where "prob rhs" is the probability of encountering a right-hand driver. This is equal to the number of right-hand drivers/total number of drivers. The starting prob rhs is 80/100 = 0.80.

prob lhs is equal to the number of left-hand drivers/total number of drivers.

prob-left-die is determined by the slider in the Netlogo program.
(1- prob-left-die) = prob right die

a. Starting expected payoff for right-hand drivers =
0.80*0 + 0.20*-0.5 = - 0.10

b. Starting expected payoff for left-hand drivers = (you calculate below)

QUESTION 7: Survival
a. Which driver type has the highest (least negative) expected payoff at the start?


b. Which driver-type do you think will survive?

c. Is an initial population of right-hand drivers an ESS against a small invasion of left-hand drivers? Why?

d. Run the Mayberry simulation five times: Do the results support your answer in question c?

Question 8.
Change the assumptions so that now the left-hand mutants all drive heavy Rolls-Royce cars; consequently, they have a lower (25%) chance of dying in a crash, while the right-hand drivers have a 75% chance of dying. Start with 100 right-hand drivers and 5 left-hand drivers. Adjust the "prob-left-die" slider to reflect the new assumptions. Gradually increase the starting number of left-hand drivers to determine the minimum size of a successful invasion. Run a number of simulations at this level to make sure it is valid most of the time. (Each time you change the starting number of left-side drivers, you need to stop the simulation and click on set-up to apply your changes.)

=>The "invasion barrier" (minimum number of invading left-side drivers) for
this scenario is _______________.


QUESTION 9 (OPTIONAL): Modify the Mayberry program so that drivers don't turn around at the edge of the screen; instead, they "wrap" around the screen and reappear on the road on the other edge of the screen. This is accomplished by turning off the part of the program that tells the drivers to turn around. The easiest way to turn off code is to type a semicolon in front of the code so that it becomes comments. This avoids losing necessary code by mistake.

After this modification, try a simulation of equal number of right and left-side drivers, and a 50% prob-left-die. Run the simulation a few times and describe what seems to be happening. Explain the results in terms of the pure Nash equilibrium from Question 3 above.


"Evolutionary Game Theory_Big Bird Replicator Dynamic" is a more complex approach to evolutionary game theory that models a "replicator dynamic" to find stability in a two-species simulation.


Author: Dr. Jeffrey E. Russell
Affiliation: Ashland University, Ashland, Ohio


(back to the NetLogo User Community Models)