|
The object of the game is to move all of the disks from one pole to another pole. Sounds simple, but of course there are some restrictions. You can only move one disk at a time. And you are not allowed to place a larger disk on top of a smaller disk.
It's not too difficult with just a few disks, but gets pretty confusing as you add more disks to the challenge (note that you can control the number of disks that you attempt). And remember, I didn't write the program for this clever game, so don't blame me for the lame solution implementation (at least with Internet Explorer, seems to work with Netscape). Below is a legend that purports to explain the origin of the game.
|
|
In an ancient city in India, so the legend goes, monks in a temple have to move a pile of 64 sacred disks from one location to another. The disks are fragile; only one can be carried at a time. A disk may not be placed on top of a smaller, less valuable disk. And, there is only one other location in the temple (besides the original and destination locations) sacred enough that a pile of disks can be placed there.
So, the monks start moving disks back and forth, between the original pile, the pile at the new location, and the intermediate location, always keeping the piles in order (largest on the bottom, smallest on the top). The legend is that, before the monks make the final move to complete the new pile in the new location, the temple will turn to dust and the world will end.
Is there any truth to this legend? Try to solve it with just 7 disks, and maybe you'll start to believe the part about the temple turning to dust. Just imagine the number of moves required to move 64 disks under the restrictions imposed!
Towers of Hanoi JavaScript programming by Adam Stock adam@digital-biz.com from The JavaScript Source
|