"""
 hanoi.py
 from Zelle's "Python Programming: an Intro to CS", chapter 13.
"""

def move_tower(n, source, destination, extra):
    """ Print out the instructions to move disk n and the disks above it. """
    if n == 1:
        print(f"  Move disk from {source} to {destination}.")
    else:
        move_tower(n-1, source, extra, destination)
        move_tower(1, source, destination, extra)
        move_tower(n-1, extra, destination, source)

def hanoi(n):
    """ Print out the instructions to move n disks from A to B """
    move_tower(n, "A", "B", "C")

def main():
    print("Towers of Hanoi")
    n = int(input("How many disks? "))
    hanoi(n)

main()