Galton Board Simulation with Physics Engine JS (Bean Machine / Quincunx) #shorts

Added:

Project Setup
Ball Creation
Elastic Collisions
Collision Code
Velocity Update
Collision Fix
Peg Layout
Peg Collision
Bucket Setup
Final Simulation

Project Setup

4:02
Playing Section
  • 1

    Outlines the three core components of the Galton board simulation: balls, pegs, and buckets.

  • 2

    Reviews the foundational JavaScript classes like Ball, Peg, and Bucket, along with key physics constants.

  • 3

    Details the initial rendering loop and how gravity is applied to the falling balls.

Basic JavaScript programming, including object-oriented concepts, loops, and canvas rendering APIs.
Fundamentals of 2D vector mathematics, including vector addition, dot products, and normalization.
Introductory classical mechanics, specifically Newtonian kinematics (gravity, velocity) and the conservation of momentum in elastic collisions.
Basic probability concepts, particularly how independent binary choices (left vs. right) generate a binomial distribution.
The Central Limit Theorem and how the binomial distribution transitions into a continuous normal (Gaussian) distribution as the scale increases.
Spatial partitioning algorithms (like Quadtrees or Grid-based partitioning) to optimize collision detection performance for thousands of particles.
Advanced rigid body dynamics, including rotational kinematics, friction, and impulse-based constraint solvers.
Using Monte Carlo simulations to model statistical mechanics, thermodynamic systems, or financial risk analysis.
313 views11likes1:23:37@TheBigIntOriginal Release: 2021-01-30

A Galton Board (or Bean Machine/Quincunx) is a physics simulation device where balls dropped from the top bounce off a series of pegs and collect in bins at the bottom, naturally forming a bell curve (binomial distribution) due to the random left/right decisions at each peg collision. This video demonstrates how to simulate this phenomenon using JavaScript, implementing 2D collision detection and resolution between balls and pegs, where each collision follows elastic collision physics principles including conservation of momentum and kinetic energy.