Algorithms are the heart of good interactive design. Where do great algorithms come from? How does a designer cook them up?
25 years ago, while I was an undergraduate physics student, I faced an interesting problem that was in essence an algorithmic challenge. I needed to randomly select one of eight pairs of lights to illuminate, and I needed to do this at random times. Nowadays, this problem would be ridiculously simple to solve with a random number generator in a computer and, but back in the early 70s we didn’t have such technology. I needed to design a random number generator that would also randomly select one of eight targets.
I cast about for random processes in the real world; there are precious few indeed. One is radioactive decay; however, detecting individual decay products would have required some fairly expensive equipment. I had to do the entire project on a budget of $270.
Another random process is the motion of particles in an ideal gas. We normally think of a gas as a set of molecules in free motion, but there’s no law of physics that requires an ideal gas to consist of molecules. They could just as well be much larger than molecules and still show the same behavior as an ideal gas. I reasoned that I could just as correctly use ball bearings. Moreover, there is nothing in the physics of an ideal gas that requires it to operate in three dimensions; two dimensions will work just as well. This provided the basis for my physical algorithm.
I started with a piece of plywood and nailed some 3/8" wooden strips to it in the form of a rectangle with a funnel at the bottom. At the bottom I placed a metal propellor attached to a motor. Then I placed some ball bearings in the chamber, tilted the plywood slightly so that the balls would naturally roll down towards the propellor, and turned on the motor.
When the propellor hit a ball, it would impart great energy to the ball, which would take off to the upper reaches of the chamber, colliding with other balls. In the lower half of the chamber, motions were dominated by the action of the propellor, and so it really didn’t act like an ideal gas, but in the upper portion of the chamber, the motions were primarily affected by ball-to-ball collisions, and so the system acted like an ideal gas.
I made a small exit hole at the top of the chamber; balls would occasionally (randomly) escape through the hole. They would then roll down a ramp to enter a Pascal cascade made of nails, bouncing left or right in three sequences to enter one of eight channels. In rolling down a channel, a ball would pass over two microswitches of my own design (two strips of copper foil a millimeter apart), closing the microswitches and activating the lights. After exiting the switch channels, the balls would roll down another ramp back to the lower portion of the ideal gas chamber.
By adjusting the tilt angle of the plywood and the number of balls in the chamber, I could get any desired rate of activity. My advisor had a good laugh over my Rube Goldberg setup, but the system worked perfectly during the twelve-hour experimental run.
Algorithms are where you find them.