Tower of Hanoi: Difference between revisions
Nikitaivanov (talk | contribs) (Created page with "--- quest: true --- [[File:]] [Tower of Hanoi](https://play.fancade.com/5EBB62523C0B03D5) by Spolarium is an adaptation of the math puzzle of the same name. == Gameplay == The gameplay features disks, and 3 pegs. The goals is to get all blocks to the last peg (chequerboarded for convenience) in a pyramid structure from biggest to smallest as fast as possible. Click a peg to dislodge a disk, and click the next peg where you wish to place the...") |
-u ndefined- (talk | contribs) (Rework page) |
||
Line 1: | Line 1: | ||
{{Game | |||
|guid=5EBB62523C0B03D5 | |||
|author=Spolarium | |||
}} | |||
'''Tower of Hanoi''' by [[The Questers#spolarium|Spolarium]] is an adaptation of the [https://en.wikipedia.org/wiki/Tower_of_Hanoi math puzzle of the same name]. | |||
== Gameplay == | == Gameplay == | ||
The gameplay features disks, and 3 pegs. The | The gameplay features disks, and 3 pegs. | ||
The goal is to get all blocks to the last peg (in checkerboard for convenience) in a pyramid structure from biggest to smallest as fast as possible. | |||
Click a peg to dislodge a disk, and click the next peg where you wish to place the disk. | |||
Here are the rules: | |||
* You can only move one disk at a time | * You can only move one disk at a time | ||
* You take either the only disk on a peg, or the top disk of a stack, and move it onto the top of another stack, or onto an empty peg. | * You take either the only disk on a peg, or the top disk of a stack, and move it onto the top of another stack, or onto an empty peg. | ||
Line 18: | Line 22: | ||
For any n disks, the minimum amount of moves to make to solve the puzzle is (2^n)-1. | For any n disks, the minimum amount of moves to make to solve the puzzle is (2^n)-1. | ||
For an even amount of disks, the following is done: | For an even amount of disks, the following is done: | ||
Line 28: | Line 30: | ||
Repeat this until the puzzle is solved. | Repeat this until the puzzle is solved. | ||
For an odd amount of disks, the following is done: | For an odd amount of disks, the following is done: | ||
Line 39: | Line 39: | ||
Repeat this until the puzzle is solved. | Repeat this until the puzzle is solved. | ||
[[Category:Quest games]] | |||
[[Category:Games]] | [[Category:Games]] |
Latest revision as of 09:59, 29 May 2024
Tower of Hanoi

Title | Tower of Hanoi |
Author | Spolarium |
GUID | 5EBB62523C0B03D5 |
Tower of Hanoi by Spolarium is an adaptation of the math puzzle of the same name.
Gameplay
The gameplay features disks, and 3 pegs. The goal is to get all blocks to the last peg (in checkerboard for convenience) in a pyramid structure from biggest to smallest as fast as possible. Click a peg to dislodge a disk, and click the next peg where you wish to place the disk. Here are the rules:
- You can only move one disk at a time
- You take either the only disk on a peg, or the top disk of a stack, and move it onto the top of another stack, or onto an empty peg.
- You may not place a disk on top of a smaller disk.
Solution
The following is an iterative solution. From left to right, we will call the pegs A, B and C.
For any n disks, the minimum amount of moves to make to solve the puzzle is (2^n)-1.
For an even amount of disks, the following is done:
- Make a legal move from A to B in any direction.
- Make a legal move from A to C in any direction.
- Make a legal move from B to C in any direction.
Repeat this until the puzzle is solved.
For an odd amount of disks, the following is done:
- Make a legal move from A to C in any direction.
- Make a legal move from A to B in any direction.
- Make a legal move from B to C in any direction.
Repeat this until the puzzle is solved.