Follow TV Tropes

Following

Context Main / TowersOfHanoi

Go To

1[[quoteright:300: https://static.tvtropes.org/pmwiki/pub/images/300px-Tower_of_Hanoi.jpeg]]
2
3->''"Towers of Hanoi? I don't think so."''
4-->-- '''Commander Shepard''', ''VideoGame/MassEffect3 Citadel DLC''
5
6A classic StockPuzzle, invented in 1883 by Edouard Lucas. The player is given three poles in a row, and at least three discs of different sizes stacked on the pole on one side. The objective is to get the discs from the pole on one side to the pole on the other by moving the discs, one at a time, from one pole to another, in as few moves as possible. The player can only move the top disc on any stack, and cannot place a bigger disc on a smaller disc.
7
8There is an (apocryphal) legend about [[ExactlyWhatItSaysOnTheTin a tower in... well, Hanoi]] where the priests of Brahma, [[BecauseDestinySaysSo in accordance with an ancient prophecy]], basically spend their time playing the game... with ''64 disks of solid gold''. Furthermore, the prophecy states that when the puzzle is finally solved, [[TheEndOfTheWorldAsWeKnowIt the world will end]]. The legend was invented by Lucas himself when he distributed the original puzzle under the SignificantAnagram N. Claus (De Siam), for E. Lucas (D'Amiens). Note that if this legend were true, even if the priests were able to move one disc per second, it would take 584,942,417,356 years, 26 days, 7 hours and 15 seconds for them to solve it -- making it a scientifically accurate prophecy; the sun would have exploded around the time the puzzle becomes 1% complete.
9
10Often used as an introduction to the concept of recursion in programming classes. Solving it requires moving ''n''-1 discs onto the vacant pole, then the ''n''th disc onto the target, then the previous pile of ''n''-1 discs on top of that one, thus requiring a total of (2^''n'')-1 moves. It's also a common, [[SolveTheSoupCans seemingly random obstacle]] in video games.
11
12'''The recursive solution is, roughly:'''
13# If there is only one disk move it directly from the source peg to the target peg. Otherwise:
14# Ignore the bottom disk of the tower on the source peg, and solve the Towers of Hanoi problem from the source peg to the spare peg, using the target peg as a spare. The spare peg now has a tower of ''n''-1 disks on it, and the source peg has one disk (the biggest) on it.
15# Move the single disk from the source peg to the target peg.
16# Solve the Towers of Hanoi problem from the spare peg to the target peg using the source peg as a spare.
17
18This counts as a solution because the "solve the Towers of Hanoi" steps in (2) and (4) are for towers one disk smaller than the previous. Solving the problem for ''n'' disks can be done if you know how to do it for ''n''-1 disks, which can be done if you know how to do it for ''n''-2 disks, et cetera... until you get down to doing it for one disk, which is trivial.
19
20If the disks are numbered, human solvers can use as a memory aid the fact that it is never correct to place an odd-numbered disk directly on top of another odd-numbered disk, and likewise for even-numbered disks.
21
22Amusingly, at least one Brahmin monastery has adopted the puzzle as a genuine devotional exercise, using approximately 30 brass discs.[[note]]A 30-disk tower would take a bit over 34 years to solve at the rate of one disk per second.[[/note]] No word if the puzzle's completion will mark the end of the current universe.
23
24----
25!!Examples:
26
27[[AC:Alternate Reality Games]]
28* ''ARG/PerplexCity'':
29** It borrows the Hindu legend for the card Tower of Cubes, though their temple only has 36 cubes to work with, and completing the puzzle will end all sorrow and grief in the universe.
30** If you move one disc per second, this would take 2,179 years, 29 days, 7 hours, 32 minutes and 15 seconds. Not as long as the other example.
31
32[[AC:Fan Works]]
33* In the ''VideoGame/SystemShock'' fanfic FreeRadical, a robot was set to do a twenty-piece version to prevent SHODAN from being able to connect to it when it went for new orders.
34* Fanfic/MyHeroPlaythrough: Izuku encounters this as an obstacle in the Labyrinth (first round of the Sports Festival). He solves it before the puzzle finishes revealing itself. He says he as seen it so many times in games, he can solve it in his sleep.
35
36[[AC:Films -- Live-Action]]
37* "Bright Eyes", the ape in ''Film/RiseOfThePlanetOfTheApes'', is seen ''flying'' through this puzzle, though it was a four disc variant and she was tested on it repeatedly.
38
39[[AC:Literature]]
40* In Creator/EricFrankRussell's story "Now Inhale", the protagonist is sentenced to death on an alien world. Traditionally, the condemned plays a game with the warder, and when it ends (win or lose) he is executed. To stretch the game out until rescuers arrive, our hero chooses the Towers of Hanoi, referencing the above legend. When the aliens discover they've been duped, they change the rules so that offworld games are not allowed.
41
42[[AC:Live-Action TV]]
43* Towers of Hanoi featured as an Aztec Zone game in the second series of ''Series/TheCrystalMaze''.
44* In the ''Series/DoctorWho'' serial "The Celestial Toymaker" (now a [[LostEpisode lost story]] except for the final episode, but available in full on audio), the Doctor is challenged to solve a 10-disc version of the Towers of Hanoi, known as The Trilogic Game. The Doctor realises that the Toymaker's world will vanish once he makes the last move, [[spoiler: so he finishes it inside the TARDIS]].
45* ''Series/{{Survivor}}'':
46** In ''Thailand'' (U.S. season 5), a large five-disk version of this puzzle was an immunity challenge. One competitor, Shii Ann, a computer programmer, seemed to have no clue at all of how to solve it, leading to some EpilepticTrees from fans about both her meta-game strategy and the actual backstage operations of the show
47** It appears as the opening challenge of ''Survivor: South Pacific'' (U.S. season 23).
48* The final mission of ''Series/TheChallenge'' season 5: Battle of the Seasons included a Towers of Hanoi puzzle; the Real World team's quick completion of this puzzle allowed them to come from behind to win the final prize.
49
50[[AC:Video Games]]
51* ''VideoGame/EverQuest'' has a quest where you have to play Towers of Hanoi, although they don't call it that.
52* ''VideoGame/StarWarsTheOldRepublic'': The Fabricator boss in the Karraga's Palace Operation requires some members of the party to solve this type of puzzle to arm the cannon that lowers the boss' defenses.
53* One of the activities in ''[[VideoGame/BlasterMysterySeries Math Blaster: Pre-Algebra]]'' is a variation on the Towers of Hanoi where barrels in the basement must be stacked to solve a math problem. Rather than varying sizes of barrels, it uses varying numbers on the barrels which must add up to the number on the platform. There are three places to put the barrels and four barrels. There are two platforms which may or may not have different numbers.
54* An old DOS and Apple II game called ''Monkey Business'' revolved around this -- a stack of monkeys is trying to reach the apples on the tree next to them, conveniently the same distance from the ground as their combined height.
55* ''VideoGame/TheBindingOfIsaac'': The Repentance+ GameMod adds an activated item called Tower of Babel, based on this puzzle. When activated, it destroys all obstacles in the current room, referencing the supposed end-of-the-world prophecy surrounding towers of Hanoi.
56* Creator/BioWare seems to like this puzzle:
57** It shows up in ''Franchise/StarWars: VideoGame/KnightsOfTheOldRepublic'', ''VideoGame/JadeEmpire'', and ''VideoGame/MassEffect1''.[[note]]''Mass Effect 1'' at least allows the player to skip the puzzle at the cost of 100 Omnigel.[[/note]]
58** In ''VideoGame/DragonAgeOrigins'', it is instead mocked by a gravestone in Haven reading "T.O. Hanoi. Unloved, unmourned."
59** But used again (repeatedly) in ''VideoGame/StarWarsTheOldRepublic'', where the puzzle is part of the [[ItMakesSenseInContext activation of a plasma vent used in the penultimate Boss Fight of Karagga's Palace]].
60** One of the game machines seen in the arcade included in the ''VideoGame/MassEffect3'' Citadel DLC is "Towers of Hanoi." Shepard's reaction: "I don't think so," likely a reference to its appearance in the first game.
61** ''VideoGame/DragonAgeInquisition'''s ''Descent'' DLC features the "Builder's Towers" puzzle as an optional sidequest, but still lampshades its infamy by having your character call it insane.
62* A side quest in ''VideoGame/BlackAndWhite'' has you doing this to move a temple further up the shore of a lake so it doesn't get flooded out during high tide, and livens up the experience by having the owner loudly complain about the destruction of his delicate furniture with every move. The inclusion of "classic" puzzles caused some reviewers to wonder whether Hanoi Towers and garbage collecting is really what gods do.
63* ''[[VideoGame/FishFillets FishFillets NG]]'' has the two characters discuss how the player finds pleasure in this stock puzzle. While there's only five disks, the overall mechanics of the puzzle game make it a bit more difficult to move disks from one tower to another (specifically, preventing a disk from falling down the wrong tower where it will lock in place, and avoid "sliding" the disk on top of solely the fish).
64* The stairway puzzle in ''VideoGame/UltimaVIII'' is a version with stair steps.
65* This is the last puzzle in ''VideoGame/TheLegendOfKyrandia: Hand of Fate''.
66* To finish ''VideoGame/ZorkZero'', the player has to go through this ''twice'' (at least). Even nastier, you're not allowed to save while in the room, and if you put a big disc onto a smaller one, it crushes the smaller one, making the game {{Unwinnable}}. Hope you saved often!
67* Subverted in the InteractiveFiction game ''The Magic Toyshop'', where you're challenged to solve the puzzle in only six moves. [[spoiler:The solution is to glue two of the disks together (using two moves), leaving you with a two-disk tower and four moves.]]
68* ''VideoGame/ProfessorLayton and the Diabolical Box'', which uses pancakes in place of discs and plates instead of pegs.
69* A side mission to explore an abandoned mansion in ''VideoGame/SpaceRangers 2'' has this as one of the puzzles.
70* The third screen in ''The Island of Videogame/DrBrain'' has this puzzle with 4, 5, or 7 discs, depending on the difficulty. Expect to be there a while on Expert difficulty making 127 moves.
71* The Tire Tower puzzle in ''VideoGame/TheSecretIslandOfDrQuandary''. 3 tires as B. Ginner, 4 as O.D. Nary, 5 as D. Feecult, and each with a limit on the moves you can use before your time is up and Quandary kicks you out of the junkyard.
72* Getting caught by Dr. X's minions in [[VideoGame/JumpStartAdventures5thGradeJoHammetKidDetective Jumpstart 5th Grade]] involves doing this with a stack of wooden crates to reach a broken window. Higher difficulty levels results in more crates to deal with.
73* In ''VideoGame/LonesomeVillage'', the Nu View puzzle is based on this, with the player using a miniature consisting of three pins and three discs to change the position of a much larger set of discs placed on three pillars in the room. By moving all the discs to the rightmost pillar, the path to the puzzle's treasure is opened.
74* Appears in its four-tier form in ''VideoGame/MysteryOfMortlakeMansion''.
75* All the time in the [[VideoGame/NancyDrew Nancy Drew series.]] There's one in ''The Haunting of Castle Malloy'' that springs to mind first.
76* One of the puzzles among the final trio of minigames near the end of ''VideoGame/ReahFaceTheUnknown''. This one plays it from the reverse angle (smallest in the back, largest in front). But it's annoying in the fact that, [[RuleOfThree like the other two puzzles, you have to do three rounds of it]], each one containing more pieces than the last.
77* Umang has to play a game of this in ''[[VideoGame/{{Aura}} The Sacred Rings]]'' using Russian doll-style statues, to place in the proper slot so Reina can summon lightning for him.
78* The robot puzzle in the secret laboratory in [[HiddenObjectGame IHOG]] ''Questerium: Sinister Trinity'' is the five-tier form. The discs (or lenses in this case) have to end up on the middle pole, so that green light can shine through them to germinate a plant seed.
79* ''VideoGame/ThreeDUltraLionelTraintown'' has a Tower of Hanoi puzzle as one of the game's missions, which is played with train cars.
80* In the video game adaptation of ''WesternAnimation/AllDogsGoToHeaven'' (which is a MinigameGame), there is a Towers of Hanoi-styled minigame.
81* ''Videogame/SunlessSea'': The Emperor's Tomb in the Empire of Hands has this puzzle as one of the various obstacles, in this case acting as the door's lock. It's lampshaded as an easy and overused StockPuzzle, matching with the general mockery of jungle temple tropes in this mission, but this one also has 15 disks[[note]]32,767 moves[[/note]], making it horribly tedious [[spoiler:and it's also badly-made, and won't actually open the door when it's solved]]. Fortunately, [[CuttingTheKnot you brought dynamite]].
82* [[https://www.glorioustrainwrecks.com/node/1490 This website]] contains a downloadable version of the full, mythical 64-disc version of the Tower of Hanoi which is fully automated. Thankfully, even this will not cause the universe to end any time soon - even running as it does at about 1,000 moves per second, it'd still take nearly 585 million years to complete!
83* ''VideoGame/{{Carto}}'' gives three versions in the Story Chalet: a 2-box, a 4-box, and a 10-box. (Fortunately, the last one has a shortcut.)
84* Diamond Alice's minigame in ''VideoGame/LaterAlligator'' involves moving a stack of pancakes onto her favorite plate, with the stack getting bigger each round. Making too many moves without solving the puzzle will cause you to fail the minigame, but there are four plates instead of three, making it easier to solve.
85* The browser game ''[[https://neutralxe.net/room/mini0/ Tower of Chicks]]'' by Neural is a version with the rings replaced by a stack of five chicks, who you have to move from one nest to another under the same rules.
86
87[[AC:Real Life]]
88* A common test (amongst others) for diagnosing schizophrenia. Schizoid-type disorders are notable for an inability to plan means-to-a-goal actions and so are impaired at the puzzle.
89

Top