June 2021
Beginner
432 pages
9h 9m
English
The Tower of Hanoi is a stack-moving puzzle game that features three poles on which you can stack various-sized disks. The object of the game is to move one tower of disks to another pole. However, only one disk can be moved at a time, and larger disks cannot be placed on top of smaller ones. Figuring out a certain pattern will help you solve this puzzle. Can you discover it? (Hint: Try setting the TOTAL_DISKS variable to 3 or 4 to solve an easier version first.)
When you run towerofhanoi.py, the output will look like this:
The Tower of Hanoi, by Al Sweigart al@inventwithpython.com Move the tower ...Read now
Unlock full access