我正在做着名的遊戲「河內塔」的練習,當我運行我的代碼時出現錯誤。但我不知道如何解決它。這裏是我的代碼: class HanoiT():
def __init__(self, content=None):
if content is None:
self.content=[]
else:
self.content=content
我正在嘗試實施河內塔的遞歸函數。 的算法是: Move n−1 disks from peg AA to peg C using peg B as intermediate storage.
Move the nth disk from peg A to peg B,
Move n−1 disks from peg C to peg BB using peg A as intermedia