Skip to content

Add Galton board at /galton#162

Open
ianalloway wants to merge 1 commit into
mainfrom
claude/galton-board-729tge
Open

Add Galton board at /galton#162
ianalloway wants to merge 1 commit into
mainfrom
claude/galton-board-729tge

Conversation

@ianalloway

Copy link
Copy Markdown
Owner

Summary

  • Adds /galton — the classic bean machine: balls bounce through pegs and pile into the binomial distribution
  • src/features/galton/board.ts: ball spawning/stepping (per-row right-deflection with probability p), bin accumulation, log-space binomial pmf (stable at 16 rows), ball x-position mapping
  • src/pages/Galton.tsx: canvas with triangular peg field, animated falling balls, bin bars, and a yellow expected-count overlay on the same scale; rows presets (8/12/16), bias slider, pause/reset
  • src/App.tsx: lazy-loaded /galton route with SEO metadata

How it works

  • Each ball advances row by row; at each peg it deflects right with probability p (default 0.5); after the last row it lands in bin = number of right-bounces
  • The yellow overlay is the honest expectation — dropped × B(rows, p) at each bin, on the same pixel scale as the bars — so the pile visibly converges to it
  • The bias slider (0.2–0.8) skews the distribution: the pile leans and the overlay leans with it, showing binomial ≠ symmetric unless p = ½
  • Log-space pmf computation avoids overflow/underflow at 16 rows; ball count is capped at 120 in flight

Test plan

  • Load /galton — balls rain through the pegs and start filling center bins
  • After ~200 balls the pile roughly matches the yellow overlay
  • Bias 0.8 — pile shifts right and the overlay matches; 0.2 — left
  • Rows 8 vs 16 — wider/narrower peg triangles and bin spreads
  • Pause freezes balls mid-fall; resume continues; reset clears bins
  • Ball stream stays aligned with peg columns at any window size
  • Counter tracks landed balls

Generated by Claude Code

Balls cascade row by row, deflecting right with probability p at each
peg (log-space binomial pmf keeps the overlay stable at 16 rows). Bins
accumulate landed balls with a yellow expected-count overlay drawn on
the same scale (dropped x pmf). Bias slider 0.2-0.8 skews the pile off
center; row presets 8/12/16 change the depth. Ball positions derive
from rights - row/2 in bin widths plus per-row jitter, so streams stay
aligned with the pegs at any canvas size.

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 a78f1f9
🔍 Latest deploy log https://app.netlify.com/projects/ianalloway/deploys/6a5c53bcddfe5800082715bc
😎 Deploy Preview https://deploy-preview-162--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 19, 2026 4:34am

@ianalloway
ianalloway marked this pull request as ready for review July 19, 2026 04:35
Copilot AI review requested due to automatic review settings July 19, 2026 04:35
@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.

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