Afterglowscreensavers

Abelian Sandpile Screensaver

Abelian Sandpile is a free, in-browser simulation of the Bak–Tang–Wiesenfeld sandpile: grains of sand dropped one at a time onto a grid, where any cell holding four or more grains topples and hands one to each neighbour, which can make them topple in turn. Dropped onto a single central point, the pile grows into a four-fold mandala of self-similar patterns that is computed exactly, not drawn. Nothing to download, and ESC exits at any time.

Live preview

Abelian Sandpile screensaver — A mandala that is exact, not drawn.

Press ESC to leave fullscreen. Settings are saved in your browser only.

How the Abelian Sandpile screensaver works

Each cell holds a count of grains, 0 to 3, drawn in four colours. A grain is dropped; if the cell now holds four or more, it topples: it loses four and each of its four neighbours gains one. Any neighbour pushed to four topples as well, and an avalanche runs until every cell is back below four. Grains that topple off the edge are lost.

The order in which unstable cells topple does not matter — the final pile is the same — which is what abelian means here, and it is why the picture is a mathematical object rather than a random one. The saver keeps a stack of unstable cells and works through it, capped per frame so a large avalanche never freezes the screen.

Dropping everything on the centre produces the celebrated image: concentric regions of stripes, checkerboards and triangles that repeat at every scale. Two drop points interfere; dropping everywhere at random gives the model’s original purpose, a system that organises itself to the edge of collapse, where avalanches of every size occur.

When the pile reaches the border the saver holds the finished figure for a few seconds, fades it out and begins again.

Self-organised criticality

The Bak–Tang–Wiesenfeld sandpile, introduced in 1987, was the first example of a dynamical system showing self-organised criticality: a system that drives itself to a critical state without anyone tuning it. Keep adding grains and a single grain may do nothing or trigger a collapse across much of the grid, with no characteristic avalanche size.

The reason the result is exactly repeatable is algebra. Three years after the original paper, Deepak Dhar showed that the model has abelian dynamics: the final stable pile does not depend on the order of toppling, and the grain-adding operations form an abelian group. That group has an identity element, a pile that leaves any other pile unchanged when added, and its picture is itself a striking fractal pattern.

Real sand does not behave quite like this idealised model, and ordinary sandpiles often fail to match its predictions. Piles of elongated grains such as rice have been shown to display self-organised criticality, but how well the model describes real systems is still debated. Its main legacy is as a model for events with bursts of every size.

A worked example

At the defaults — Centre, Cell size 4, 5 grains per frame, Dune palette — a small mottled square appears at the centre and grows outward, its interior resolving into a lattice of diagonal stripes cut by triangular patches that themselves contain smaller stripes and patches. On a large screen the pile takes a couple of minutes to reach the edge. Switch to Everywhere for a shifting, avalanche-riddled texture with no centre.

Settings & tips

Frequently asked questions

What is the abelian sandpile model?
A model introduced by Bak, Tang and Wiesenfeld in 1987 to illustrate self-organised criticality: a system that drives itself to a state where disturbances of every size happen. Dhar later showed the toppling order does not matter, hence “abelian”, and the single-point pile became a famous mathematical image.
Why does the pile have such regular patterns?
Because the rule is deterministic and the same everywhere, the pile from a single source has an exact structure, and its patterns provably repeat at every scale as the number of grains grows — a fractal that emerges from simple arithmetic.
Will this slow my computer down?
It is tuned to run smoothly on an ordinary laptop. If it feels heavy, raise the Pixel size or lower the speed in the settings; every control takes effect immediately.
Is the Abelian Sandpile screensaver free?
Yes. It runs free in your browser with nothing to download or install, and it keeps working offline once the page has loaded.
How do I exit the Abelian Sandpile screensaver?
Press the ESC key at any time to leave fullscreen and return to the page.
What is self-organised criticality?
It is the tendency of some systems to settle, on their own, into a critical state where events of all sizes can happen. The sandpile was the first example of it.
Is the sandpile a good model of real sand?
Only loosely. Ordinary sand piles often fail to match its predictions, though piles of elongated grains like rice have shown self-organised criticality. Its validity as a model of real systems is still debated.
Why does the final pattern not depend on toppling order?
Dhar showed the model has abelian dynamics: whichever unstable cell you handle first, the same final pile results. That property is what makes the sandpile abelian.

← All Generative screensavers