A wooden pegboard computer where falling marbles count, add and multiply in binary.
Six rocking bits run down a pegboard. Each rocker's lower arm blocks one of two holes: a marble slides down its free face, wedges against the arm, and its weight tips the rocker over, so it drops through the hole it just uncovered. A bit at 0 flips to 1 and lets the marble fall out; a bit at 1 flips to 0 and sends it rolling into the next bit, which is a carry. Nothing scripts that logic: an impulse solver integrates rigid marbles, capsule rails and each rocker's rotation, inertia, over-centre spring and end stops, six substeps a frame. A glass tube above each bit adds its place value, so the board counts, adds A then B, and multiplies by shift-and-add, while a bucket lift returns spent marbles from the tray to refill the tubes.
Try it. Pick Count, Add or Multiply to run a program, or Build to drag ramps, crossovers, catches and extra bits onto the pegs (drag a part off the board to remove it). Click a tube to drop its next marble (hold to stream), click a bit to flip it by hand, or click anywhere on the board to drop a marble there. Space pauses, N steps one frame, S toggles slow motion and 1 to 4 switch modes.
Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.
Build a marble-powered binary counter with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.
Start simple:
- Make a full-window canvas, sharp on high-DPI screens, with a light wooden background.
- Write a tiny 2D physics engine: marbles are circles with gravity, rails are line segments with a thickness. Each step, push any overlapping marble out of a rail along the contact normal and cancel its velocity into the rail (with a little bounce). Use several substeps a frame.
- Make a "bit": a rocker on a pivot with an angle, angular velocity, a moment of inertia, end stops at plus and minus 25 degrees and a weak spring that pushes it away from the middle so it rests at either stop. When a marble touches the rocker, apply the impulse to both, using the contact point's distance from the pivot, so the marble's weight can tip it.
- Shape the rocker so its lower arm blocks one of two holes. A marble funnelled onto it wedges against the arm, tips it, and drops through the hole it uncovered: one hole leads out, the other into the next bit, below and to the right.
- Stack four bits down a diagonal and drop a marble into the first one every second.
Once that works, make it beautiful:
- Draw the rockers as coloured acrylic paddles with brass hubs, the rails as wooden strips with soft shadows, and the marbles as glass with a highlight and a band that rotates as they roll.
- Show the register as lamps and a decimal number read straight from the rockers' angles.
- Let me click a rocker to flip it and click anywhere to drop a marble.
Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as a glass tube above each bit so you can add any number, multiplication by shift-and-add, or a lift that carries spent marbles back up to the top.