NOGDUS

Articles, Tutorials, and other things. => Miscellaneous => : Richard Marks January 06, 2009, 01:32:03 PM



: Puzzle Solving: Towers of Hanoi
: Richard Marks January 06, 2009, 01:32:03 PM
Puzzle Solving: Towers of Hanoi

Towers of Hanoi is an ancient puzzle game that consists of three towers, or poles, or sticks, etc... and some number of donut/ring shaped layers that differ in size from largest on the bottom to smallest on the top.
Your objective is to move the layers from the leftmost tower to the rightmost tower.

I present the solution to a three-layer puzzle: ACABCBACBABCAC

Now, I bet you are thinking "what the hell is this guy talking about? How is that a solution?!" ;D

Here, let me explain it.

  • You know that the puzzle has only three towers, so label them from left to right: Tower A, Tower B, Tower C.
  • You know that you can only move the topmost layer from a tower to a tower that is either empty, or has a larger layer already on it. You cannot place layers that are larger on top of layers that are smaller.
  • You know that you can move only one layer at a time, and you know that you must move all three layers from Tower A to Tower C.

Take each pair of letters in that weird string of letters, and use them as starting and ending towers.

Here we then have seven steps to solving the three-layer puzzle.

Step 1
Move the topmost layer from Tower A to Tower C.
Step 2
Move the topmost layer from Tower A to Tower B.
Step 3
Move the layer we placed on Tower C to Tower B.
Step 4
Move the last layer from Tower A to Tower C.
Step 5
Move the topmost layer from Tower B to Tower A.
Step 6
Move the topmost layer from Tower B to Tower C.
Step 7
Finally move the layer from Tower A to Tower C.

Whew!
What you think? :D


Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.