MCPcopy Index your code
hub / github.com/python/cpython / Tower

Class Tower

Lib/turtledemo/minimal_hanoi.py:24–36  ·  view source on GitHub ↗

Hanoi tower, a subclass of built-in type list

Source from the content-addressed store, hash-verified

22 self.st()
23
24class Tower(list):
25 "Hanoi tower, a subclass of built-in type list"
26 def __init__(self, x):
27 "create an empty tower. x is x-position of peg"
28 self.x = x
29 def push(self, d):
30 d.setx(self.x)
31 d.sety(-150+34*len(self))
32 self.append(d)
33 def pop(self):
34 d = list.pop(self)
35 d.sety(150)
36 return d
37
38def hanoi(n, from_, with_, to_):
39 if n > 0:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…