diff options
author | Julin S <48789920+ju-sh@users.noreply.github.com> | 2019-10-23 03:23:48 (GMT) |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-10-23 03:23:48 (GMT) |
commit | a4aeb336697c85996d781271cc6b42bc6d4c2908 (patch) | |
tree | 7ea5badbae3285e922e84fe95fe2a676ca2e7110 /Tools/demo/hanoi.py | |
parent | 20bf8e08a18c0f1eab49c54f3bd56f8364a2f5cc (diff) | |
download | cpython-a4aeb336697c85996d781271cc6b42bc6d4c2908.zip cpython-a4aeb336697c85996d781271cc6b42bc6d4c2908.tar.gz cpython-a4aeb336697c85996d781271cc6b42bc6d4c2908.tar.bz2 |
bpo-38539: Update demo files (GH-16890)
Diffstat (limited to 'Tools/demo/hanoi.py')
-rwxr-xr-x | Tools/demo/hanoi.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Tools/demo/hanoi.py b/Tools/demo/hanoi.py index dad0234..8db895c 100755 --- a/Tools/demo/hanoi.py +++ b/Tools/demo/hanoi.py @@ -27,7 +27,7 @@ def hanoi(n, a, b, c, report): class Tkhanoi: # Create our objects - def __init__(self, n, bitmap = None): + def __init__(self, n, bitmap=None): self.n = n self.tk = tk = Tk() self.canvas = c = Canvas(tk) @@ -77,7 +77,7 @@ class Tkhanoi: # Run -- never returns def run(self): - while 1: + while True: hanoi(self.n, 0, 1, 2, self.report) hanoi(self.n, 1, 2, 0, self.report) hanoi(self.n, 2, 0, 1, self.report) @@ -94,7 +94,7 @@ class Tkhanoi: # Lift the piece above peg a ax1, ay1, ax2, ay2 = c.bbox(self.pegs[a]) - while 1: + while True: x1, y1, x2, y2 = c.bbox(p) if y2 < ay1: break c.move(p, 0, -1) @@ -103,7 +103,7 @@ class Tkhanoi: # Move it towards peg b bx1, by1, bx2, by2 = c.bbox(self.pegs[b]) newcenter = (bx1+bx2)//2 - while 1: + while True: x1, y1, x2, y2 = c.bbox(p) center = (x1+x2)//2 if center == newcenter: break @@ -114,7 +114,7 @@ class Tkhanoi: # Move it down on top of the previous piece pieceheight = y2-y1 newbottom = by2 - pieceheight*len(self.pegstate[b]) - 2 - while 1: + while True: x1, y1, x2, y2 = c.bbox(p) if y2 >= newbottom: break c.move(p, 0, 1) |