This webpage provides a sandbox to play with sandpiles. Sandpiles were the 90th activity in Annie Perkins' Math Art Challenge.
In a sandpile, each cell has a certain number of grains of sand in it. A cell is unstable if it has more than three grains (more generally, at least as many grains as neighbours). An unstable cell can topple, whereupon it gives one grain to each of its neighbours.
This implementation is slightly different to how sandpiles work in the literature as I slightly misunderstood the instructions. In the literature, a "turn" consists of a single cell toppling. Although on a given turn there is a choice, in the long run then the order of choices doesn't matter.
In my version, however, on a given turn then every cell that is currently unstable topples. This can lead to a different type of long term behaviour. In particular, it makes sense to consider periodic long term behaviour.
With pretty much anything mathematical on a grid I find myself asking "What does this look like on a torus?", shortly followed by a Klein bottle and a projective plane. This determines what happens when cells on the edge topple. The options are: