count = 0
def hanoi(n,A,B,C):
'''
算法①先将n-1个碟子借助C,从A移到B;
②将第n个碟子从A移到C;
③将n-1个碟子借助A,从B移到C;
'''
global count
'''
if n = 1 :
print("Move ", str(n)," from " ,A ," to ",C )
'''
if n ==0 :
return
else :
hanoi(n-1,A,C,B)
print("Move ", str(n)," from " ,A ," to ",C )
count+=1
hanoi(n-1,B,A,C)
#测试
hanoi(4,"Left","Mid","Right")
print(count)