|
TowerOfHanoi
|
Hanoi is a class that takes the action of moving disks between rods. It does this by encapsulates Rods for start, destination, and auxilary. More...
#include <hanoi.h>

Public Member Functions | |
| Hanoi (int disks, bool printState) | |
| Initializes a Hanoi class with the size of the problem and whether we want to know state. More... | |
| void | execute (std::ostream &out=std::cout) |
| A function that executes the number of disk moves and reports the move set. More... | |
Hanoi is a class that takes the action of moving disks between rods. It does this by encapsulates Rods for start, destination, and auxilary.
| Hanoi::Hanoi | ( | int | disks, |
| bool | printState | ||
| ) |
Initializes a Hanoi class with the size of the problem and whether we want to know state.
This constructor will also initalize the disks on the start rod and swap aux and dest rods on even # of disks.
| [in] | disks | - the number of disks that we want to solve the puzzle for. |
| [in] | printState | - Determine if we want to print the state per move set. |
| void Hanoi::execute | ( | std::ostream & | out = std::cout | ) |
A function that executes the number of disk moves and reports the move set.
The Tower of Hanoi puzzle has a formulaic set of movement rules for fixed number of moves at 2^n -1. The solution is knowing which move to do. wich is determined by taking the modulo of the number of rods (3).
| [in] | out | The out stream |