Towers of Hanoi puzzle game applied to real-life and work

The Towers of Hanoi game is a very clean, effective puzzle to learn problem solving, and also learn problem analysis. It’s easy to play with 2-3 discs, and becomes more challenging for inexperienced people with more discs.

After learning the method to solving, it becomes easy, where each additional disc simply doubles the time it takes to solve the puzzle. The real challenge then becomes keeping track of which level within which stack you need to move.

I often refer to this puzzle in conversation, when doing things in life that require moving lots of stuff, physically, mentally, emotionally. It’s come up in my facebook status messages.

For example, I moved to a new location a year ago, and prior to that, the process of packing to move, I had to sort all my stuff, and sort boxes in my possession, then arrange all the boxes. Like the towers-of-hanoi!  That’s a bit of an over simplified explanation, but when I’d spent 10-15 hours working in one non-stop shift, this puzzle came to mind.  And I found a random website with the game and played it for a few minutes.

The solution, written on Wikipedia’s Towers of Hanoi page:

The puzzle can be played with any number of disks, although many toy versions have around seven to nine of them. The game seems impossible to many novices, yet is solvable with a simple algorithm. The number of moves required to solve a Tower of Hanoi puzzle is 2n -1, where n is the number of disks.

Iterative solution

The following solution is a simple solution for the toy puzzle.

Alternate moves between the smallest piece and a non-smallest piece. When moving the smallest piece, always move it to the next position in the same direction (to the right if the starting number of pieces is even, to the left if the starting number of pieces is odd). If there is no tower position in the chosen direction, move the piece to the opposite end, but then continue to move in the correct direction. For example, if you started with three pieces, you would move the smallest piece to the opposite end, then continue in the left direction after that. When the turn is to move the non-smallest piece, there is only one legal move. Doing this will complete the puzzle using the fewest number of moves to do so.

It should perhaps be noted that this can be rewritten as a strikingly elegant set of rules:

Simpler statement of iterative solution

Alternating between the smallest and the next-smallest disks, follow the steps for the appropriate case:

For an even number of disks:

  • make the legal move between pegs A and B
  • make the legal move between pegs A and C
  • make the legal move between pegs B and C
  • repeat until complete

For an odd number of disks:

  • make the legal move between pegs A and C
  • make the legal move between pegs A and B
  • make the legal move between pegs B and C
  • repeat until complete

In each case, a total of 2n-1 moves are made.

Keeping this puzzle in mind, and understanding the process of solution, it makes it easy to solve MANY problems in life.  Then when a person may say “hey it’s not easy to solve ____”, I’d respond that it’s truly a transformation of challenging to easy, and the challenge isn’t so much in figuring out what the solution is, but keeping track of where you are within the solution. Keeping calm must be a requirement, otherwise a person may throw their hands up in the air in frustration, and storm off to vent. Feeling relaxed and knowing the solution can be achieved if keeping down the same path, single-handling much of it, is the way to final success.

Anyway, this is what I’m thinking about right now, and it seemed a good subject to post publicly about.

This entry was posted in Technology, Thoughts and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *