By Jay Parmar
The C++ code that lets you solve the Tower of Hanoi Problem by giving Step-By-Step instructions to move the Discs from one Rod to another.
Tower of Hanoi is a puzzle which have three (3) rods standing vertically together and there are N number of Discs of different sizes stacked one on top of the other in decreasing order of the size.
The puzzle starts with N discs stacked in Rod A. The player is required to place those N discs in that exact sequence on Rod C but there are some rules to be followed :
1. The player must not pick more than one disc at a time.
2. The disc is able to move to a rod only when there is either a disc (or stack) already present LARGER THAN THE CURRENT DISC (topmost disc of the stack) or the Rod is empty.
When done manually, it is pretty tough to solve the game when the number of discs are large. But with the help of this code, that is only a matter of seconds!
Submitted by Jay Parmar (JAYPARMAR)
Download packets of source code on Coders Packet