Thursday, February 4, 2010

Tower of Hanoi

Today in Math 10 Wings class, Mr Cheng showed us a game on the internet and let us play it. The game was called Tower of Hanoi, and we were supposed to figure out how to beat the game in the least amount of moves. At first I just did Trial and Error to figure it out, and then i started to get the game - it really wasn't thaat hard. Overall, i thought Tower of Hanoi was an okay game - it is not the most fun game ever, but it makes you think a bit and it kinda addicting. I'm probably not ever going to play it again after math class though.



Describe the Strategy and the formula for the puzzle Tower of Hanoi.

For 3 Rings - You start by putting the smallest ring on the far right, so that you can put the second smallest on the second post, and then put the smallest on top of the second one also. This frees up the far right pole to put the biggest ring there. Then you proceed to put the smallest ring on the far left pole, so that you can put the second ring on top of the biggest ring, and then finish the game.

For 4 Rings - You start by putting the smallest ring on the second post (When there is an even number of rings, you start with the second post, while when you have an odd number of rings , you start on the far right post). Then you put the second smallest on the far right, and then put the smallest ring on top of that. The third ring goes on the second pole, and then you use the same steps to put the second ring on top of the third ring, and then put the smallest ring on that (Move the smallest ring to the post that the third ring is not, which in this case is the far left post). Now the far right post is freed up for the biggest ring, and so you move that there. After that, you move the smallest ring on top of the biggest ring, then put the second ring on the empty pole so that you can move the smallest piece onto it. Then move the third ring on the biggest ring, and move the smallest two rings on top of that in the previous way (move the smallest ring off, then put the second ring on the third ring, and then put the smallest one on the second one). Essentially, you have just all the steps for the 3 Rings game, a move to put the largest ring on the far right pole, and all the moves for the 3 Rings game again (taking into account that you start with all the rings on the second pole compared to having them start in the first pole, and that you want them on the third pole instead of the second pole).

For 5 Rings - The Tower of Hanoi game follows a pattern. To do the 5 Ring version, you follow all the moves in the 3 Ring game, and then moves from the 4 Ring game to free up the largest ring so that you can put it on the far right pole. After that, you just do all the same moves again (taking into account that you are starting with all the rings on the second pole instead of the first pole, and you want them on the third pole instead of the second pole).

Formula For The Miniumum Amount of Moves -

Minimum amount of moves for n amount of rings = 2^n - 1

No comments:

Post a Comment