This translation is older than the original page and might be outdated.

User Tools

Site Tools


Zero-sum dynamics - Tutorial for EcoVirtual


The concept of a zero-sum game comes from game theory, and describes a division of a fixed amount of resource between each participant, in such a way that one player can only win what the other players lose.

If we model the profits and subsequent losses as happening with a certain probability, the game acquires a stochastic dynamic, similar to the one present in the neutral theory of biodiversity. Its author, Stephen Hubbell, assumes that communities are saturated with individuals, such that a new individua may only become established if another one dies. The random succession of deaths, births, and arrival of migrants would then create a zero-sum dynamic, explaining the patterns found in natural communities.

In this tutorial, we will simulate a very simple stochastic zero-sum dynamic. Then, you can study its application on our tutorial about the neutral theory of biodiversity.

A silly game

Let's imagine a simple gambling game between two players, with no ties. Every round, the player that lost the gamble pays a fixed amount to the winner. Both players have the same probability of winning at each round. This is a zero-sum game, as the total amount of money in possession of both players never changes. The only thing that changes is the fraction of that amount that each player possesses. If we allowed for different winning probabilities for winning, or for the transferred amount to change in any way, it would still be a zero-sum game.

In our simulation, "the game only ends when it's over", what means that we only stop the simulation when one player has lost all its money1).

To proceed, you must have the R environment with the Rcmdr and Ecovirtual packages installed and loaded. If you do not have and do not know how to have them, see the Installation page.

Let's simulate this situation with the function Zero Sum Game. Open the EcoVirtual menu in Rcmdr: EcoVirtual>Biogeograph models> Zero Sum Game. The following window will open:


In this function we have 3 parameters:

Option Effect
Total amount the total amount of money in the game\\In the start of the game, it is evenly divided between the players
Bet size the amount that the loser pays to the winner
Maximum game time maximum game time (in real world minutes)

The argument Maximum game time is not part of the games rules - it's just a precaution against the simulation taking too long. Fix it around 10 minutes, but most simulations should end way before this time.

What determines the game length?

The simulation will run until the game is over. Vary the total amount of the game and assess what difference does it make on the game length. Some suggestions:

  • Total amount = 20, bet size = 1
  • Total amount = 20, bet size = 5
  • Total amount = 100, bet size = 1
  • Total amount = 100, bet size = 5

In stochastic dynamics, the result may change every time the simulation is run, even if the parameters are exactly the same. Thus, it's important that you repeat each simulation a couple of times to be sure of the results main tendency.


  1. What is the effect of the total amount and of the bet size over the game length?
  2. Is this game a process of one-dimensional random walk? Explain your answer.
if the simulation takes to long, you can also interrupt it
en/ecovirt/roteiro/math/zerosumrcmdr.txt · Last modified: 2017/11/21 10:07 by melina.leite