##### The Tower of Hanoi is an interesting mathematical game or puzzle, which ably tests a person’s intellect.

The Tower of Hanoi is a very popular mathematical game, which is also treated as a puzzle because of its ability to test a person’s intellect. The origin of this game still remains an unsolved mystery, but there are a couple of legends/myths indicating towards the supposition that the game might have its roots in Asian countries such as India and Vietnam. The credit for popularizing the game in the western part of the world goes to the French mathematician Édouard Lucas. This is the reason why the game is also known as Lucas’ Tower.

According to one legend, there’s a temple in the vicinity of the Kashi Vishwanath shrine (famous pilgrimage center of Lord Shiva and the river Goddess Ganga) in Varanasi, India, where there are three long-time worn posts located in a large room inside the temple. The posts are surrounded by 64 golden disks, which have to be moved by Brahmin priests as per the command of an ancient prophecy serving the incontrovertible rules of Lord Brahma. The legend further says that when the last move of this puzzle would be completed, the world shall come to an end.

Another legend that’s very relevant to the game of the Tower of Hanoi is the variation of the one mentioned above. According to this alternate telling, the temple is a monastery or any other religious place of worship, and the priests were monks. The monastery is said to be located in many different parts of the world, including Hanoi, the capital city of Vietnam. Additionally, the story states that the temple or the monastery was created at the beginning of time, and that the priests or monks may only make one move per day. However, a consensus or an official acceptance of any of the above theories is yet to be witnessed in relation to the origin of the Tower of Hanoi game.

Typically, the game consists of three rods and a number of disks of different sizes that can fit any rod. The objective of the game is to transfer the disks stacked above each other in the ascending manner of their diameter. The disks have to be shifted from the left-most rod to the last rod on the right. The puzzle starts at the left-most rod, where the disks are arranged according to their size to form a conical structure, resembling a pyramidal tower. The game ends when a player manages to move all the disks from the left-most rod to the right-most rod, and in the correct structure at that. That is, the tower created by stacking the disks on the right should be exactly alike the one on the left at the start of the game.

The rules for playing this game are as follows:

- Only one disk can be moved at a time.
- Each move consists of taking the upper disk from one of the stacks and placing it on top of another stack i.e. a disk can only be moved if it is the uppermost disk on a stack.
- No disk may be placed on top of a smaller disk.

The rules may also be slightly altered in case of playing the game only in a specific direction. A good example of this can be seen in the game Cyclic Hanoi, a variation of the Tower of Hanoi, where each disk must be moved in the same direction. Mostly in cyclic Hanoi, the disks have to be moved in clockwise direction.

The most probable solution for a game of the Tower of Hanoi, is the number of moves made by a player to transfer all the disks from the left-most tower to the right-most one. There is also a mathematical equation derived for the same, which gives the formula for a standard and logical solution to every game of the Tower of Hanoi. The equation is represented by: 2^{n} – 1, where n = number of disks the game is being played with.

A regular Tower of Hanoi game being played with 3 disks should wind up in 7 moves at maximum. Similarly, a game of 4 disks should end in 15 moves, a game of 5 disks in 31 moves and so on.

Apart from the above mathematical solution, the Tower of Hanoi game can have a variety of solutions such as an iterative solution, a recursive solution, a non-recursive solution, a binary solution and a gray code solution.

## Tower of Hanoi - Game

Your objective is to move all the disks from tower 1 to tower 3. Each move that you make will be recorded below and compared against the minimum moves for deriving a solution. Only one disk can be moved at a time, and it also cannot be placed on top of a larger disk. You also have the option of increasing or decreasing the number of disks in play. Moving the disks is enabled by dragging and dropping them by using the mouse.

## Add new comment