# coding:utf-8
c = 0
# move中的n表示盘子的编号
def move(x,n,z):
global c
c += 1
print ‘%d. Move disk %d from %s to %s\n’ % (c,n,x,z)
# hanoi中的n表示盘子的个数,借助y将x上的盘子移动到z
def hanoi(n,x,y,z):
c = 0
if n == 1:
move(x,1,z)
else:
hanoi(n-1,x,z,y)
move(x,n,z)
hanoi(n-1,y,x,z)
hanoi(3,’a’,’b’,’c’)