The Tower of Hanoi (also called Towers of Hanoi) is a mathematical game or puzzle. It consists of three pegs, and a number of discs of different sizes which can slide onto any peg. The puzzle starts with the discs neatly stacked in order of size on one peg, smallest at the top, thus making a conical shape.
The object of the game is to move the entire stack to another peg, obeying the following rules:
- only one disc may be moved at a time
- no disc may be placed on top of a smaller disc