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:
- Select a random cell
- 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'
- The next step is probabilistic, with a probability 'p' of birth and '1-p' of death
- 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
- Death: Kill the occupant of the current cell
- Repeat from the beginning
Blue - Birth ; Red - Death
Updates to probability get reflected immediately
Grid gets cleared when size is updated
Note:
- If p < 0.5, then there is a pretty high chance that your population will go extinct within a couple of steps
- If you want to paint a pattern and watch it's evolution, then pause the simulation while doing so
- Related: Bernoulli Percolation, Directed Percolation, Porous Percolation.
Developed by ChanRT | Fork me at GitHub