Tag:Hanoi

  • [C language programming] Hanoi Tower problem, using C language to achieve Hanoi Tower!

    Time:2021-6-15

    The tower of Hanoi problem is that there are three needles a, B and C on a board. There are 64 discs of different sizes on the a-needle, which are arranged in the order of the big one at the bottom and the small one at the top. To move the 64 discs from a-needle […]

  • How to realize Hanoi tower with Python

    Time:2020-4-3

    Using animation to realize Hanoi Tower problem: import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): if not self.isEmpty(): return self.items[len(self.items) – 1] def size(self): return len(self.items) Def drawpole 3(): draw the poles of Hanoi Tower t = turtle.Turtle() […]