🗳️ Voter Model & Noisy Voter Dynamics (2D) — Real Consensus Dynamics
2D voter-model lab: agents copy a random neighbour's opinion on a lattice, with an optional spontaneous-flip noise term. Watch consensus emerge or a fluctuating steady state persist, with live magnetisation, interface-density and cluster-size readouts.
A flat 2D canvas rendition of the classic and noisy voter models: every step, one randomly chosen cell copies the opinion of a randomly chosen von-Neumann neighbor — no shortcuts, the same asynchronous update rule the 3D version runs — and an optional flip-noise term lets each update instead adopt a uniformly random opinion. Watch consensus emerge from a uniformly random start, or, with noise switched on, watch it never arrive.
🔬 What It Demonstrates
Every update, one random cell looks at one random neighbor and copies its opinion (or, in Noisy Voter mode, adopts a random opinion with probability p instead). Because updates are asynchronous — later picks in the same sweep see already-changed cells — this reproduces the analytic voter-model dynamics exactly rather than approximating them with a synchronous cellular automaton.
🎮 How to Use
Pick Classic Voter or Noisy Voter from the dropdown, then adjust lattice size, flip-noise probability, initial blue fraction and update speed. Reset rebuilds the lattice, Pause freezes the run for inspection, and Randomize jumps to a fresh configuration. Click or drag directly on the lattice to paint opinions by hand and perturb a run mid-flight.
💡 Did You Know?
This 2D version pairs with the site's 3D GPU-textured rendition of the same model — same underlying update rule (real asynchronous neighbor-copying, real flip-noise), rendered differently. Comparing the two is a good way to confirm the mechanics, not just the visuals, are equivalent.
About the Voter Model & Noisy Voter Dynamics (2D)
This is a plain 2D canvas rendition of the voter model, one of the simplest agent-based models of opinion dynamics, computed directly into an ImageData buffer rather than through a GPU texture. Every cell on a periodic square lattice holds one of two opinions. Each update step draws a random cell and a random one of its four von-Neumann neighbors, and the cell adopts that neighbor's opinion — an asynchronous process, not a synchronous sweep, so the dynamics match the model's analytic definition exactly.
On a finite lattice the plain voter model always drifts to consensus (all one colour), because copying is an absorbing random walk with no mechanism to sustain disagreement forever. Switching to the Noisy Voter mode adds a per-update probability p of ignoring the neighbor and adopting a uniformly random opinion instead; even a small p keeps reseeding disagreement fast enough that the blue fraction settles into a fluctuating steady state rather than freezing at 0% or 100%. Live readouts track the blue fraction (the model's magnetisation), the interface density (the fraction of neighboring cell-pairs that disagree), the largest same-colour cluster found by flood-fill, and whether the lattice has reached consensus.
Frequently Asked Questions
How is this different from the 3D version?
Both run the identical asynchronous voter-model update — a random cell copies a random von-Neumann neighbour's opinion, with an optional flip-noise term. The 3D version renders the lattice as a GPU data-texture on a WebGL quad and its chart as a fragment-shader line; this version rasterises the lattice into a 2D canvas ImageData buffer and draws the chart with the 2D canvas path API. The dynamics, not just the rendering, are the same.
Why does the classic voter model always reach consensus?
On a finite lattice, copying a neighbour's opinion is an absorbing random walk: once every cell shares one colour there is no mechanism left to change it, and eventually a random sequence of copies reaches that state. There is no stable mixed configuration for the plain voter model, only a random walk toward one of the two consensus states.
Why does noise prevent consensus?
The Noisy Voter mode gives every update a probability p of picking a uniformly random opinion instead of copying a neighbour. Even a small p keeps reintroducing disagreement faster than local copying can erase it, so the blue fraction fluctuates around a steady-state value instead of ever freezing at 0% or 100%.
What does the interface density measure?
It is the fraction of neighboring cell-pairs (checked to the right and below each cell, periodic wrap included) that hold different opinions. It falls toward 0% as the lattice nears consensus and stays elevated whenever noise or a mixed initial state keeps disagreement alive.
What does "largest cluster" measure?
It is the size of the biggest connected group of same-colour cells, found with a flood-fill (breadth-first search) over the four-directional neighbourhood. Watching it grow toward N² shows local copying snowballing into large-scale consensus.
Does lattice size (N) change the outcome?
Larger lattices take longer to reach consensus because an opinion has to propagate across more cells before it can dominate, but the underlying dynamics — consensus in Classic Voter, a noisy steady state in Noisy Voter — are the same regardless of N.
2D voter-model lab: agents copy a random neighbour's opinion on a lattice, with an optional spontaneous-flip noise term. Watch consensus emerge or a fluctuating steady state persist, with live magnetisation, interface-density and cluster-size readouts.
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install