Contents

Note: to access the interactive material, you must have installed the Mathematica Player (either autonomously or as a browser plug-in)

(When opening a CDF interactive file, click on "Enable Dynamics"; then, if you use the Player, F12 puts it in full screen).

The Atractor's article "Isomorphic Games" (at the moment, only in Portuguese!), published in issue no. 169 of Gazeta da Matemática, a journal of SPM, presents a relation between the Tower of Hanoi puzzle and a game of lamps:

To see the full text of the article, click here. To play both games and to see some practical information about them, continue reading this page.

The game of lamps starts with a row of lamps which are all off. Then, by clicking one of the lamps, either its state (on or off) changes or all lamps remain in the same state; this depends on the state of the lamps, according to a precise rule. The goal of the game is to end up with the rightmost lamp on and all the others off.
In this cdf, you may try to find out what the rule is (by clicking on the lamps).

(If you are not able to find the rule, see the description given at the end of the article of the Gazeta)

As discussed in the article, this game is equivalent to a special version of the Hanoi Tower puzzle. Click here to see how you may find a solution for one of the games by solving the other.
In this cdf, you can choose between the classical version of the Tower of Hanoi, which is not equivalent to our game of lamps, and its special version. If you choose the special version, given the above equivalence, you can proceed simultaneously in both games by clicking, at any time, on the Tower of Hanoi or on the game of lamps:

In the examples above, it is equivalent to change the disk from rod 1 to 2 (fig 1) or to click on the marked lamp (fig 2).

Using the procedure shown in figures 1 or 2, the final result will be the same.

And you may observe that when playing the special version, in the last move when you achieve the final configuration for one of the games, you will also get the final position for the other game.

Let us see now what happens when you choose the classical version of the Tower of Hanoi puzzle. There is only one way to solve it with a minimum number of moves. For example, for three disks, the solution with a minimum number of moves requires the following 7 moves.

Rod 1 Rod 2 Rod 3
Start green, red, blue
1 red, blue green
2 blue green red
3 blue green, red
4 blue green, red
5 green blue red
6 green red, blue
7 green, red,blue

Confirm the table above in the following pictures:

We will call the set of all intermediate "positions" of the disks in the rods a minimal path when it solves the game in the minimum number of moves. In the case above, the minimal path will be:

{((green, red, blue),(),()),  ((red, blue), (green), ()),  ((blue), (green), (red)),  ((blue), (), (green, red)), ((), (blue), (green, red)),  ((green), (blue), (red)),  ((green), (red, blue), ()),  ((), (green, red, blue),())}.

With this terminology, it should be noted that, even without leaving the minimal path, one may make many more moves than the minimum number if one goes back and forth one or more times. (On the contrary, if you never undo the previous move, there is only one way to follow the minimum path.)

As long as you do not leave the minimal path, there will be always a perfect match between the Tower of Hanoi game (classical version) and the game of the lamps. Undoing the previous move on the towers corresponds in the game of lamps to resetting the previous state of the last lamp that changed its state.

The moment you make a move with the disks that leaves the minimal path, that correspondence is broken and the lamps disappear. This is what happens in the case below (in the classical bicolor version), where the position shown in 4 does not correspond to an element of the minimal path and therefore the correspondence with the game of lamps is interrupted: the lamps disappear.

Try playing the classical version in 2 different ways: with only 2 colors or as many colors as the disks. When playing with disks, in which case is it easier not to get out of the minimal path?
When you are familiar with both games, increase the number of disks / lamps.


This work integrates interactive components in CDF format prepared with the Mathematica program. To use these files, you must download them to your computer and access them with the CDF Player, which can be downloaded for free from http://wolfram.com/cdf-player

This text is a slightly modified version of the following article (in Portuguese) published by Atractor in Gazeta de Matemática


(*) Difficulty level: Upper Secondary, University