Troll Calendar


Troll calendar at noon on spring equinox

The troll calendar is a device that can accurately predict the spring equinox. The device consists of seven platforms arranged in a circle. A troll (not pictured) sits in the middle of the circle and manipulates the device each night.

On top of each of the 7 platforms are three towers with anywhere from zero to nine tiles. There are nine tiles of different sizes cut in such a way that when they are stacked from largest on the bottom to smallest on the top, and squared to the cardinal directions, as pictured, the shadow of the sun aligns with the northern corners at the spring equinox. The view, above, shows the configuration for the 2010 spring equinox with all nine tiles on northern stack of the north platform (this configuration recurs every 21 years). The viewer is looking toward the south.

The troll follows the rules of the Towers of Hanoi puzzle to do some of the calculations of the device. The Towers of Hanoi puzzle has the following rules:
Using these rules (plus a couple of his own rules -- see, below), the troll moves one tile on each of the seven platforms each night. There are 9 tiles in each puzzle, so, moving optimally, it takes 511 (29-1) moves to completely move all nine tiles from one tower to another. There are seven platforms. Each platform is 219 moves ahead or behind the platform touching it, so a tower is completed on each of the seven platforms in sequence over the entire cycle of  1533 (7 x 219) moves.

Dividing 1533 moves by 21 towers, we get 73 moves. Every 73 moves, a different tower is completed. This is where the computation of the equinox comes in. Every 5 completions takes 365 moves, or about one year.

The App


The iPad app uses the magnetic compass to orient the device toward true north. Additionally, it automatically starts up configured correctly for the current date. The user can see what the configuration looks like on other dates by using swipe gestures. Here are the recognized gestures:

Note that the tiles on one of the platforms are orthogonal (squared up) to the platform they rest on. This is the one that is pointing North. The device is oriented toward North so that the shadows will align properly at the equinox. On the day of the equinox, the shadow of a point on the edge of one tile travels along the top edge of the next larger tile, if the two tiles are on top of each other. Since the sun travels across the sky from east to west, the edge of the tile must be oriented east-west. On the spring equinox, all nine tiles are in a single stack on one of the seven platforms. With all the tiles in a single stack, their shadows align on the northern edge.

There is also a leap day algorithm implemented, internally, in the app. There is no display for the leap day scheme, but here is how it works.

There are 8 stones that rest on the edge of 1 or 2 neighboring platforms. When the troll wakes up at midnight to do his manipulations, he looks at the leftmost platform with stones to see if the closest tower on that platform has nine tiles on it (all tiles in one tower). If it does, the troll moves one stone to the platform on the right and turns around, facing away from the platform(s) with stones, then goes back to sleep without manipulating any tiles.




This turning around is important. It creates two days in a row with the same configuration except for the direction the troll is facing and the arrangement of stones. The stones thus can be thought of as a count of leap days. One complete solar cycle occurs when all 8 stones are moved. That is 8 leap days in 33 years, making a solar year 365 8/33 days long. The 8 stones return back to their original position after 7 such 33 year cycles - 231 years with 56 leap days.

How does the troll know how to manipulate the Towers of Hanoi?

It turns out, there is a very simple procedure that the troll uses -- which is good, since the troll has a very small brain. The troll looks at each platform in sequence, starting with the leftmost one with stones and working clockwise until he finishes all seven. For each platform, he looks to see which tiles can be legally moved according to the Towers of Hanoi rules. The smallest tile can always be moved. There usually also is one other tile that can be moved (if all tiles are on a single tower, only the smallest tile can be moved). He first tries to move the larger of the two. If it can be moved in the appropriate direction, the troll moves it. Otherwise, the smallest tile is moved. So what is the appropriate direction?

The tiles are numbered from smallest to largest (1..9). All the odd-numbered tiles move in one direction (toward the troll). All the even numbered tiles move in the opposite direction (away from the troll). If such a move results in the tile moving off the platform, it is moved to the opposite end. This is still considered to be a move in that same direction (see illustrations, below). In the app, the odd and even tiles are colored dark and light respectively. The troll moves dark (odd numbered) tiles toward himself and light (even numbered) tiles away from himself. This results in an optimal solution to the Towers of Hanoi puzzle.




Here's a closeup of a typical scenario. The two tiles that can be moved according to Towers of Hanoi rules are the smallest, dark tile, and the next smallest tile, a light tile. The troll first tries moving the larger of the two, the light tile, away from him (away from the heptagon). That turns out to be a legal move, so that's what the troll does.



The following night, the troll has the above scenario. The same two tiles as before have legal moves. He tries to move tile number 2, the smallest light tile, but that is an illegal move according to Towers of Hanoi rules because that would place it on top of the dark, smallest tile #1, which is a smaller tile. It is not permissible to place a larger tile on a smaller tile. So the troll doesn't move tile number 2. He could move it closer to him according to the Towers of Hanoi rules, but he always moves light colored tiles away from himself, so he doesn't even consider that option. So he moves the smallest dark tile instead, on top of the brown #2 tile:




On each platform, there are three positions, near, middle, and far. Moving a tile toward the troll means moving from far to middle or from middle to near or from near to far. Moving a tile away from the troll means moving from near to middle or from middle to far, or from far to near.