On Christmas my new brother-in-law received a charming little plastic puzzle by the maker of Rubik's Cube and Rubik's Magic: Rubik's Clock. It's a roughly circular gadget with nine small dials on the front and another nine dials on the back. In the midst of these dials are four push buttons that extend all the way through the box so that if you push a button in on one side it will pop out on the other. There are also four thumb wheels arranged around the edge of the box, and each wheel turns one subset of dials on the front and a different subset on the back.
Which subset, you ask? Hold on - it get's worse! Every time you push in one of the four center buttons the subsets associated with each thumbwheel change. Got it? Now then, the object of this fiendish contraption is to push the buttons and turn the thumbwheels until all eighteen dials are pointing straight up, "high noon" as it were.
I haven't even tried to figure out how to solve this weird little puzzle, but the box itself fascinated me. How does it work? Clearly there are gears inside, probably lots and lots of gears. The push buttons must disengage some gears and engage other ones. Fascinating. But since my brother-in-law was due to fly out the next day, I didn't have much time to play with it. So I decided to make myself a copy.
WHAT IT DOES
This month's installment of Mr. Wizard is a working copy of this Rubik's Clock puzzle. Since this thing is patented and copyrighted to the hilt, I must ask that you not pass it around, but I hope you will spend a few minutes playing with it. (Push the "Push Me" button to jump to the stack.)
In order to portray a three dimensional object I had to take a few liberties. Thus the screen shows both the front and back sides of the clock simultaneously (which is rather better than the real thing). If you click on one of the four push buttons you will notice that it pushes in on one side and pops out on the other (with a delightful popping noise).
In order to simulate thumbwheels, I have placed little clockwise and counterclockwise arrow buttons next to each wheel. Just click on one of these arrows to advance the dials one unit in either direction. Since it takes a few seconds to update all eighteen dials, you will have to watch carefully (and repeat the process several times) in order to determine what subset is currently associated with each thumbwheel. As you turn the wheels the clock emits a "tick-tock" noise.
HOW IT WORKS
The hardest part of this project was drawing all the little dials and buttons. In addition to designing the card itself, I had to create dozens of little icons in order to achieve the animation. Fortunately, the new HyperCard makes this process much easier than it was before.
If you pull down the Icon Editor and examine the icons stored in this stack, you will see twelve dial icons, one for each possible position. The icons are numbered so that I can assign any position to any dial by simply changing an icon number. You will also notice special icons for the thumbwheel arrows and for the in and out positions of the push buttons. Designing all of these little dodads took me several hours.
The next step was to figure out how the miserable little box actually worked. I could have smashed the thing and taken it apart, but this might have offended my new brother-in-law. So instead, I got out a yellow pad and made a table showing all possible button positions (there are 16), the four tumbwheels, and which subsets of dials are associated with each combination. From this table I was able to predict exactly what would happen when turning a wheel in any given situation.
The third and final step was relatively easy. In order to bring my creation to life, all I had to do was enter a copy of my table into a hidden text field and then write a very simple script to look in the approprate part of that table and set the dials accordingly. The script of each thumbwheel is one line, for example, "turn 2,clockwise." The relatively short "turn" script, along with all other pertinent scripts, can be found in the card level.
I probably shouldn't tell you this, but the scripts on the card level also include an "adjust" script. This makes it possible to manually adjust any one of the eighteen dials without affecting the rest of the clock. I did this so that I could set my software clock to exactly the same position as the actual plastic clock, and then make identical movements in order to test my copy. There's a simple trick required to invoke this function, which you can discover for yourselves by examing the script.
As I said at the outset, I still haven't gotten around to solving this thing. I will be curious to hear if any of you are able to find a solution. Happy Twiddling!