Box2D Binary Counter
Ian Parberry's "Introduction to Game Physics"
Box2D Binary Counter

This toy uses Box2D to implement a 5-bit gravity-driven ripple-carry counter that counts from zero to \(2^5 - 1 = 31\).

The key to this toy is the single-bit counter shown below. Bits that are 1 are represented by soccer balls. Bits that are zero are represented by the lack of a soccer ball. For example, the image on the left represents a 0, and the image on the right represents a 1.

There is an LED readout for the number of balls released and an array of nixie tubes showing that number in binary. It takes a few seconds for the carry to ripple down after the release of a new ball, after which the current binary number represented by the soccer balls is read aloud and the corresponding soccer balls (or lack of them) highlighted by a spinning reticle.

Keyboard Controls

Key
Action
F1 Help (this document)
Backspace Reset
Space Increment the counter
PrtScr (hold down) Save screenshot to a PNG file

The LARC Engine

This code uses the LARC Engine and is part of the LARC Code Base.