Billiard Ball Computing · Pygame on WebAssembly

Open-source, browser-native billiard ball simulator.

Design reversible logic with mirrors, balls, inputs, and outputs. Built with pygame + pygbag so everything runs in your browser.

Open fullscreen Space to start · R to reverse Open source · remix freely
Open Source

Transparent and remixable

Python sources ship with the build. Fork, teach, or extend—everything lives in this web package.

Interactive examples

Pick a motif to see how geometry becomes logic.

AND gate

Two balls converge on a mirror set, collide, and only a simultaneous arrival reaches the output.

Input A + Input B launched in sync. Corner mirrors align both trajectories to the same cell. Collision redirects both balls to the AND output pad.

Run the simulator

Click “Launch in page”
The WASM build streams in and shows the pygame canvas. If it looks paused, click the canvas once.

Open-source & browser-native

Source included

All Python files ship inside the web build for easy inspection and remixing.

Zero installs

Runs entirely in WebAssembly via pygbag. Serve build/web and you’re live.

Teach & extend

Use it in classrooms or demos—fork the code, add presets, and share.

How to build