Skip to content

Add percolation phase-transition demo at /percolation#165

Merged
ianalloway merged 2 commits into
mainfrom
claude/percolation-729tge
Jul 22, 2026
Merged

Add percolation phase-transition demo at /percolation#165
ianalloway merged 2 commits into
mainfrom
claude/percolation-729tge

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

Summary

  • Adds /percolation — an interactive site-percolation lattice where a phase transition is directly visible
  • src/features/percolation/perc.ts: fixed per-site noise field thresholded at p (so the slider grows/shrinks one configuration continuously), flat-array BFS cluster labeling, spanning-cluster detection, fill and largest-cluster stats
  • src/pages/Percolation.tsx: canvas lattice with the spanning cluster in bright green, p slider with live distance-to-p_c readout, auto-sweep through the critical region, new-field reroll
  • src/App.tsx: lazy-loaded /percolation route with SEO metadata

How it works

  • Each site holds a fixed uniform random value; it's open iff that value < p — so dragging the slider adds/removes sites monotonically instead of resampling, which makes the transition legible
  • BFS labels connected clusters; a cluster touching both top and bottom rows is the spanning cluster and renders bright green
  • Below p_c ≈ 0.5927 there's (almost) never a spanning cluster; above it, (almost) always — near p_c it flickers into existence and the largest-cluster share jumps, the classic second-order phase transition
  • Auto-sweep ping-pongs p between 0.35 and 0.75 to replay the transition; the p_c readout turns yellow within ±0.02 of critical

Test plan

  • Load /percolation — p=0.45, scattered dim clusters, "disconnected"
  • Slide p up — at ~0.59 a bright green spanning cluster snaps in, header flips to "⚡ percolates"
  • Slide back down — spanning cluster breaks apart around the same region
  • Auto sweep — the transition replays each pass through p_c
  • Largest-cluster % jumps sharply through the transition while fill % rises smoothly
  • New field rerolls; the exact transition point shifts slightly (finite-size effects)
  • Slider grows/shrinks the same pattern — sites don't rearrange
  • Resize builds a fresh lattice fitted to the window

Generated by Claude Code

Sites open where a fixed per-site uniform noise field falls below p, so
scrubbing the slider continuously grows/shrinks the same configuration
instead of resampling. Flat-array BFS labels clusters and finds a
spanning cluster touching both top and bottom rows; it renders bright
green against dim open sites, snapping into existence near the site
percolation threshold p_c = 0.5927 (distance to p_c shown live, header
flags percolating state, fill %, and largest-cluster %). Auto-sweep
ping-pongs p through the critical region to replay the transition.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WgEKRuVdor8KhaiPkv38aQ
@netlify

netlify Bot commented Jul 19, 2026

Copy link
Copy Markdown

Deploy Preview for ianalloway ready!

Name Link
🔨 Latest commit 6ab5a41
🔍 Latest deploy log https://app.netlify.com/projects/ianalloway/deploys/6a614b3c0c7160000800de51
😎 Deploy Preview https://deploy-preview-165--ianalloway.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@vercel

vercel Bot commented Jul 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ian-web-forge Ready Ready Preview, Comment Jul 22, 2026 10:59pm

@ianalloway
ianalloway marked this pull request as ready for review July 19, 2026 04:45
Copilot AI review requested due to automatic review settings July 19, 2026 04:45
@cursor

cursor Bot commented Jul 19, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ianalloway
ianalloway merged commit d27a0f9 into main Jul 22, 2026
3 of 4 checks passed
@ianalloway
ianalloway deleted the claude/percolation-729tge branch July 22, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants