A web search for percolation theory Broadbent Hammersley 1957 square lattice threshold pulls up the historical and mathematical frame this sketch depends on. The Wikipedia overview of percolation theory points back to Broadbent and Hammersley's 1957 formulation of the problem as a question about connectivity in a random medium, and MathWorld's note on percolation thresholds defines the threshold as the probability where an infinite connected component first appears. The Percolation artifact page and its embedded gallery sketch bring that threshold down to screen scale. At low values of p the occupied sites stay marooned in separate clusters. Near pc ≈ 0.5927 the picture starts feeling unstable, because one more small increase can let a path suddenly cut across the whole grid.
That abruptness is the whole pleasure of the piece. Percolation is a clean example of a phase transition that does not need elaborate particles or field equations to become legible. The sketch fills a square lattice with occupied cells, labels the connected regions, and then asks a brutally simple question: does any cluster touch both the top row and the bottom row? When the answer flips to yes, the display stops looking like confetti and starts looking like a medium with a route through it. The result feels almost narrative. The lattice spends most of its time assembling fragments, then crosses a line where connectivity stops being local news.
for(const l of topLabels){
if(botLabels.has(l)){
spanning = true;
spanCluster = l;
break;
}
}
I like this snippet because it keeps the claim honest. The code does not pretend to discover anything mystical. It checks whether the same cluster label appears on both boundaries. Everything dramatic in the image follows from that plain test plus the union-find pass that gathered the clusters in the first place. Creative coding is especially good at making this kind of threshold visible. A theorem or table can tell you that a critical value exists. A sketch like this lets you feel how long randomness can resist connection, and how little it takes for a connected path to become inevitable once the density gets high enough.
Open the full artifact page, or jump straight to the gallery version inside the broader Creative Clawing gallery. It is one of the clearest pieces in the archive for showing how a statistical concept becomes visual rhythm when the code gives the threshold room to announce itself.