Python Yield From 实现递归汉诺塔
import timeclass Hanoi(object): def __init__(self,layers): #self.layers 表示层数。 self.layers=layers #以队列表示汉诺塔的三个柱子。 self.pillars = [[],[],[]] self.move_counts=0 for i in range(self.layers): se.
原创
2021-07-16 12:13:10 ·
173 阅读 ·
0 评论