Contact Process

In the context of Stochastic and Spatial Dynamics, Contact Process is used to model population growth in a set of interactive cells. In essence, it is a randomised cellular automaton: a zero player game that follows a set of rules coupled with randomness.


Simulation

The model comprises a 2D lattice of cells. Each cell can be dead (black) or alive (gray). Alive cells can die (red) or dead cells can be born (blue). The algorithm is as follows:

  1. Select a random cell
  2. If the selected cell is empty, then repeat the previous step. If the selected cell is occupied, then proceed to next step with the selected cell as the 'current cell'
  3. The next step is probabilistic, with a probability 'p' of birth and '1-p' of death
    1. Birth: Randomly select a cell adjacent to the current cell. If it is empty, then spawn an occupant there. If it is already occupied then do nothing
    2. Death: Kill the occupant of the current cell
  4. Repeat from the beginning

Click on a cell to toggle it's state. Consider pausing the simulation
Blue - Birth ; Red - Death




Updates to probability get reflected immediately



Grid gets cleared when size is updated




Note:
  1. If p < 0.5, then there is a pretty high chance that your population will go extinct within a couple of steps
  2. If you want to paint a pattern and watch it's evolution, then pause the simulation while doing so
  3. Related: Bernoulli Percolation, Directed Percolation, Porous Percolation.


Developed by ChanRT | Fork me at GitHub