n8's blog

learning zig via percolation

TODO write words

the thread this post is based on

tinkering w zig by implementing percolation (one of my all-time favorite ideas). I got hooked on this while researching under my former professor Dr. Ziff (che.engin.umich.edu/people/ziff-...)

[image or embed]

— n8 (@alternatebuild.dev) December 28, 2024 at 2:22 AM

the above is (to be specific) 2D bond percolation, meaning that bonds (edges) are the things that appear randomly (instead of a site being randomly occupied with some P)

imagine: people in a static grid forming friendships with immediate neighbors, smaller friend groups merging into larger ones

— n8 (@alternatebuild.dev) December 28, 2024 at 2:22 AM

I often come back to this to get a feel for new languages and refresh my math brain

after researching this, I remember constantly drawing parallels between these mechanics and macroscopic "idea proliferation" or more concretely at that time, contact-tracing COVID

I still just think its pretty

— n8 (@alternatebuild.dev) December 28, 2024 at 2:22 AM

more on percolation en.wikipedia.org/wiki/Percola...

and code here github.com/zzstoatzz/pe...

e.g. I used this command to make the gif above

ANI_SAVE=animation.gif GRID_SIZE=25 P=0.5 ./run

[image or embed]

— n8 (@alternatebuild.dev) December 28, 2024 at 2:22 AM

made it faster and added new plot for max cluster size. sigmoids are common here, since at some point the largest clusters merge and so you get very rapid growth of the dominant cluster. btw this phenomenon is the "phase transition" in the condensed matter framing of percolation

[image or embed]

— n8 (@alternatebuild.dev) December 28, 2024 at 4:15 PM

#percolation #zig