Skip to content

Commit

Permalink
Use whrandom instead of rand.
Browse files Browse the repository at this point in the history
Run 500 steps instead of forever.
  • Loading branch information
gvanrossum committed May 19, 1998
1 parent 15527e9 commit 29892d8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Demo/tkinter/guido/electrons.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ def __init__(self, n, bitmap = None):
self.tk.update()

def random_move(self,n):
import whrandom
c = self.canvas
for i in range(1,n+1):
p = self.pieces[i]
c = self.canvas
import rand
x = rand.choice(range(-2,4))
y = rand.choice(range(-3,4))
x = whrandom.choice(range(-2,4))
y = whrandom.choice(range(-3,4))
c.move(p, x, y)
self.tk.update()

# Run -- never returns
def run(self):
try:
while 1:
for i in range(500):
self.random_move(self.n)
except TclError:
try:
Expand Down

0 comments on commit 29892d8

Please sign in to comment.