Percolation Theory (2D) — Site & Bond Lattice, Union-Find
A live square-lattice percolation lab: a weighted union-find over independently random sites or bonds finds the spanning cluster the instant it forms, so you can watch the phase transition happen as you drag p through the critical threshold p_c.
This 2D companion runs the same site/bond percolation theory as the 3D version through a plain, readable canvas view: a weighted union-find with path compression tracks connectivity across the lattice, two invisible "virtual" nodes wired to the top and bottom rows let the page detect the exact moment a spanning cluster forms, and because every site or bond is assigned a fixed random number once (not re-rolled on every drag), sliding the occupation probability p reveals more of the same underlying randomness rather than a new random pattern each time — so you can watch the giant component grow continuously as p crosses the critical threshold p_c, rather than jumping between unrelated snapshots.
2D percolation lab on a real square lattice: a weighted union-find over independently random sites or bonds finds the spanning cluster live as you drag the occupation probability p through the critical threshold p_c ≈ 0.593 (site) or exactly 0.5 (bond).
2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install