@@ -27,7 +27,7 @@ def hanoi(n, a, b, c, report):
2727class Tkhanoi :
2828
2929 # Create our objects
30- def __init__ (self , n , bitmap = None ):
30+ def __init__ (self , n , bitmap = None ):
3131 self .n = n
3232 self .tk = tk = Tk ()
3333 self .canvas = c = Canvas (tk )
@@ -77,7 +77,7 @@ def __init__(self, n, bitmap = None):
7777
7878 # Run -- never returns
7979 def run (self ):
80- while 1 :
80+ while True :
8181 hanoi (self .n , 0 , 1 , 2 , self .report )
8282 hanoi (self .n , 1 , 2 , 0 , self .report )
8383 hanoi (self .n , 2 , 0 , 1 , self .report )
@@ -94,7 +94,7 @@ def report(self, i, a, b):
9494
9595 # Lift the piece above peg a
9696 ax1 , ay1 , ax2 , ay2 = c .bbox (self .pegs [a ])
97- while 1 :
97+ while True :
9898 x1 , y1 , x2 , y2 = c .bbox (p )
9999 if y2 < ay1 : break
100100 c .move (p , 0 , - 1 )
@@ -103,7 +103,7 @@ def report(self, i, a, b):
103103 # Move it towards peg b
104104 bx1 , by1 , bx2 , by2 = c .bbox (self .pegs [b ])
105105 newcenter = (bx1 + bx2 )// 2
106- while 1 :
106+ while True :
107107 x1 , y1 , x2 , y2 = c .bbox (p )
108108 center = (x1 + x2 )// 2
109109 if center == newcenter : break
@@ -114,7 +114,7 @@ def report(self, i, a, b):
114114 # Move it down on top of the previous piece
115115 pieceheight = y2 - y1
116116 newbottom = by2 - pieceheight * len (self .pegstate [b ]) - 2
117- while 1 :
117+ while True :
118118 x1 , y1 , x2 , y2 = c .bbox (p )
119119 if y2 >= newbottom : break
120120 c .move (p , 0 , 1 )
0 commit comments