Sandpiles - Numberphile
Why Code Golf Stack Exchange recommends it
Code Golf Stack Exchange question writers link it as background reading for sandpile challenges, so solvers understand the toppling rules and the identity sandpile.
Recommended by 1 people across 1 different months, 2017 to 2022.
What it is
A Numberphile interview in which mathematician Luis David Garcia-Puente explains abelian sandpiles, the toppling rule on a grid, and how adding piles produces fractal-like patterns and an identity element. Brady Haran films it, with sandpile visualisations supplied by David Perkinson and Cameron Fish.
Cited in 1 Wikipedia article, including Abelian sandpile model.
What people said
Recommends orlp · 2017-01 · Code Golf Stack Exchange · on “Find the identity sandpile”
This question is about abelian sandpiles [LINK] . Read this previous challenge [LINK] and watch this numberphile video [this video] to learn more. An abelian sandpile of size n by n is a grid containing the number 0, 1, 2 and 3 (representing the number of grains of sand). Adding two sandpiles works by first adding element by element, and then toppling any element that goes above 3. The order in which you topple doesn't matter, the end result is the same. When a cell topples its number decreases by 4, and each of its direct neighbors increases by 1. This can cause a chain reaction. If a cell is on the edge of the grid, any grains that fall off the grid while toppling disappear. For example, I'm ad
Cites L3viathan · 2017-03 · Code Golf Stack Exchange · on “Topple the sandpile”
(There are related questions about infinite sandpiles [LINK] , and finding identity elements of sandpiles [LINK] .) Given a matrix of non-negative integers, return a matrix of the same dimensions, but toppled : If the matrix doesn't contain any values larger than 4, return it. Every "cell" that is larger than 3 gets reduced by 4, and all directly neighboring cells (above, below, left, and right) are incremented, if they exist. GOTO 1. Examples: 0 1 0 0 2 0 2 4 0 -> 3 0 1 0 0 3 0 1 3 1 2 3 2 3 4 2 5 1 4 1 2 0 3 3 0 3 3 0 3 3 4 5 6 -> 2 4 4 -> 4 2 3 -> 0 5 4 -> 3 2 1 -> 3 3 1 -> 3 3 2 7 8 9 5 7 7 2 6 5 4 3 2 0 5 3 1 1 4 1 2 0 (You only need to return the final result. The path on which you rea
Cites AnttiP · 2022-02 · Code Golf Stack Exchange · on “Quicksand (piles)”
In this fastest-code [LINK] challenge, you take a positive integer as input, which represents the height of a sand pile, located at (0,0) on an infinite square grid. For example, if our input is 123 , the sand grid looks initially like this: \$\begin{matrix} \ddots & \vdots & \vdots & \vdots & \cdot^{\cdot^\cdot} \\ \cdots & 0 & 0 & 0 & \cdots\\ \cdots & 0 & 123 & 0 & \cdots \\ \cdots & 0 & 0 & 0 & \cdots \\ \cdot^{\cdot^\cdot} & \vdots & \vdots & \vdots & \ddots \end{matrix}\$ Now, piles of sand are unstable, so they topple if their height is 4 or greater. When sand piles topple, they send sand equally in all four directions, but due to the quantum nature of sand, the amount sent is an inte