πΌTower of Hanoi Test
Move all 4 disks to the last peg in as few moves as possible, without stacking big on small.
Move all 4 disks from the left peg to the right peg. Click a peg to pick up its top disk, then click another peg to drop it. You can never place a larger disk on a smaller one.
Can you plan several moves ahead without trapping yourself? Take this free Tower of Hanoi Test to solve the classic three-peg planning puzzle. Move the full stack from the starting peg to the target peg while following two rules: move only one disk at a time, and never place a larger disk on top of a smaller disk.
Your result can show total moves, time, rule violations, and how close you came to the mathematically optimal solution.
How to Take the Tower of Hanoi Test
- 1Choose the number of disks.
- 2Press Start Test.
- 3Move one disk at a time.
- 4Place each disk on an empty peg or on a larger disk.
- 5Work toward moving the entire tower to the target peg.
- 6Avoid unnecessary moves.
- 7Complete the puzzle.
- 8Compare your move count with the minimum possible number.
For a fair first attempt, solve the puzzle without looking up the recursive strategy.
What Is the Tower of Hanoi?
The Tower of Hanoi is a classic mathematical puzzle generally credited to French mathematician Γdouard Lucas, who introduced it in the 19th century. The puzzle contains three pegs, several disks of different sizes, and one starting stack arranged largest to smallest. The goal is to transfer the entire stack to another peg without ever placing a larger disk on a smaller disk.
The rules are simple, but the planning problem becomes increasingly difficult as disks are added. That combination has made the Tower of Hanoi useful in mathematics, computer science, cognitive psychology, and neuropsychological research.
What Is the Minimum Number of Moves?
For the standard three-peg Tower of Hanoi with n disks, the minimum number of moves is 2βΏ β 1. Examples:
- β3 disks β 7 moves
- β4 disks β 15 moves
- β5 disks β 31 moves
- β6 disks β 63 moves
- β7 disks β 127 moves
Every extra disk approximately doubles the required solution length. This gives the puzzle an unusually clear objective benchmark. If you solve a 4-disk puzzle in 15 legal moves, you reached the optimal solution. If you use 22 moves, you completed the task successfully but took 7 moves more than necessary.
Why the Formula Is 2βΏ β 1
To move the largest disk, every smaller disk must first be moved out of its way. For an n-disk puzzle: move the top nβ1 disks to the spare peg, move the largest disk once, then move the nβ1 disks onto the largest disk. If solving nβ1 disks requires the minimum M(nβ1) moves, then M(n) = 2M(nβ1) + 1. Starting with M(1) = 1, this produces 1, 3, 7, 15, 31, 63... which is 2βΏ β 1. The optimal structure is recursive.
What Does the Tower of Hanoi Test Measure?
In cognitive research, the Tower of Hanoi has often been used as a planning and executive-function task. Successful performance can involve:
- βplanning ahead
- βworking memory
- βrule maintenance
- βinhibition of tempting but unhelpful moves
- βproblem representation
- βstrategy formation
- βmonitoring progress
- βerror correction
But the puzzle is not a pure measurement of one executive ability. Research comparing Tower tasks shows that performance can reflect several cognitive processes, and even related tasks such as Tower of Hanoi and Tower of London are not perfectly interchangeable. That means one online score should not be converted into a general "executive function percentage."
Why Planning Ahead Matters
The puzzle punishes locally attractive moves. A move can look useful because it puts one disk closer to the target, but that move may block the larger structure needed later. Strong performance therefore requires thinking beyond "where should this disk go now?" and asking "what configuration do I need before I can move the next large disk?" This is planning through intermediate goals β the optimal solution repeatedly creates temporary subgoals before making progress toward the final tower.
Tower of Hanoi vs. Tower of London
These two tests are often grouped together, but they are not the same. Tower of Hanoi uses the classic disk-size rule and a highly structured recursive solution. Tower of London typically uses colored balls or disks and presents multiple start/goal arrangements requiring a limited number of moves. Both can involve planning, but research has found only moderate relationships between their performance measures, which argues against treating them as identical measures of the same executive process.
Minimum Moves vs. Fastest Time
The best time is not necessarily the best planning performance. Imagine Player A solves the puzzle in 15 optimal moves in 45 seconds, while Player B uses 23 moves in 30 seconds. Player B moved faster but made more unnecessary moves. Which is better depends on what the test emphasizes β for a planning puzzle, solution efficiency deserves more weight than raw mouse speed.
Useful results include completion status, moves used, minimum possible moves, extra moves, completion time, and rule errors. A combined score should make its formula transparent.
Move Efficiency
A useful descriptive metric is minimum moves divided by actual moves, times 100. For a 4-disk puzzle solved in 20 moves, that is 15 Γ· 20 Γ 100 = 75% move efficiency. This is intuitive, but it is a game metric β not a standardized psychological score. It tells users how close their solution was to the mathematical optimum. It does not mean they have "75% planning ability."
Why More Disks Become Much Harder
Difficulty does not increase linearly. Adding one disk increases the optimal move count from 15 (4 disks) to 31 (5 disks) to 63 (6 disks) β the solution length grows exponentially. The mental challenge also grows because you must maintain more nested subgoals. A player who solves 3 disks easily may find 6 disks dramatically harder. Scores should therefore be separated by disk count β a 25-move solution on a 4-disk puzzle and a 40-move solution on a 5-disk puzzle cannot be compared directly.
The Recursive Strategy
The optimal strategy can be expressed recursively. To move n disks from Peg A to Peg C: move nβ1 disks from A to B, move the largest disk from A to C, then move nβ1 disks from B to C. Each subproblem follows the same structure. This is why the Tower of Hanoi is widely used to teach recursion in computer science. Once you understand the pattern, large puzzles become more systematic β but that also means repeated attempts are not equivalent to the first attempt. After learning the recursive algorithm, you are executing known knowledge rather than discovering a plan from scratch.
What Is a Good Tower of Hanoi Score?
The mathematically objective part is simple: optimal moves = 2βΏ β 1. Beyond that, there is no universal online psychological benchmark. A good game performance could reasonably mean the puzzle completed, no illegal moves, close to minimum moves, and efficient completion time. Avoid unsupported claims such as "under 30 seconds = genius" or "6 disks = top 5%" β those require standardized data from the exact implementation.
Can Tower of Hanoi Diagnose Executive Dysfunction?
No. Tower tasks have been used in neuropsychological research, but a browser puzzle cannot diagnose ADHD, brain injury, dementia, frontal-lobe impairment, or executive dysfunction. Performance can change because of prior puzzle knowledge, motivation, strategy, device controls, distraction, and mathematical familiarity. Use the page as a planning puzzle and cognitive demonstration.
Frequently Asked Questions
Who invented the Tower of Hanoi?
The puzzle is generally credited to French mathematician Γdouard Lucas in the 19th century.
What is the minimum number of moves?
For n disks, the minimum is 2βΏ β 1.
What is the minimum for 5 disks?
31 moves.
Is Tower of Hanoi an executive-function test?
It has been used in executive-function research, especially for planning, but performance depends on multiple processes and prior strategy knowledge.
Is Tower of Hanoi the same as Tower of London?
No. They are related planning tasks with different structures and should not be treated as interchangeable.
Is faster always better?
No. Move efficiency is central. A fast solution with many unnecessary moves may be less optimal than a slower minimum-move solution.
Can this test diagnose a cognitive problem?
No. It is an online puzzle, not a standardized clinical assessment.
The puzzle becomes easier when you stop thinking one move at a time. Instead ask: what smaller tower must I move before the next large disk becomes available? That shift β from immediate moves to nested subgoals β is the heart of Tower of Hanoi planning. Solve it once by intuition, then try again and see how close you can get to the mathematical optimum.
Want to try something else?
Browse all free tests β