Severity: Warning
Message: fopen(/tmp/ci_sessionma8ofltqpqn272ikjqd50nadi65qvnnk): failed to open stream: No space left on device
Filename: drivers/Session_files_driver.php
Line Number: 176
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
Severity: Warning
Message: session_start(): Failed to read session data: user (path: /tmp)
Filename: Session/Session.php
Line Number: 143
Backtrace:
File: /var/www/html/application/controllers/Project.php
Line: 10
Function: __construct
File: /var/www/html/index.php
Line: 311
Function: require_once
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
Comments