People often think of computers as magical boxes that mysteriously format our documents or calculate trigonometric functions. This is not the case. Computers can only follow instructions by taking advantage of the physics of electricity and magnetism. Any task computers perform is physically present on either the hard drive or RAM (Random Access Memory). Essentially, the bottom line is that there’s nothing magical about a motherboard or a graphics card. In fact, you could build those parts out of wood if you had a lot of time on your hands. I don’t have quite that much time, but I did manage to build a basic calculator out of wood and marbles. Unlike the device you’re reading this on, my calculator calculates with gravity and collisions instead of electricity and resistance.
The calculator takes two single-digit binary numbers and returns the two-digit sum. Because a single-digit number in binary can only be a one or a zero, I chose to represent a one as a marble, and a zero as no marble.
To input numbers, the correct marbles are placed at the top, on each of the highest slanted pieces.
The result of the calculation can be read by checking if there is a marble in the low horizontal pieces, which are meant to catch the marbles. The centered horizontal piece indicates the first binary digit, while the left one indicates the second digit.
Any marbles used are dropped simultaneously from the top of the calculator and roll down. If there are two marbles dropped (1 + 1), then they will collide and roll down the middle. One will be caught in a small groove in the wood and the other will roll over it, spilling into the second binary digit. If one is dropped from either position (1 + 0 or 0 + 1), it will roll down either side unhindered and fall into the first decimal place. If zero marbles are dropped (0 + 0), nothing will roll into either binary digit.
All the calculator does is take advantage of the physical properties of its hardware to take inputs and process an output. Just like an electric calculator. Not so magical now that you know how it works, huh? Somewhat like a message from another of my favorite movies, The Prestige.
“The secret impresses no one. The trick you use it for is everything.”
The C++ version of this calculator can be found here. Make sure to stay tuned to The Roundup for the next installments in my computer science column.