A forum where anything goes. Introduce yourselves to other members of the forums, discuss how your name evolves when written out in the Game of Life, or just tell us how you found it. This is the forum for "non-academic" content.
-
lifeisawesome
- Posts: 86
- Joined: April 22nd, 2016, 1:55 pm
- Location: poland
-
Quote
-
Login to like this post
Post
by lifeisawesome » December 1st, 2017, 12:43 pm
This is the code I'm using:
Code: Select all
import time, golly as g
x = int(g.getstring("Enter generation delay (in milliseconds):"))/1000
if x <= 0:
g.show("Invalid number.")
exit()
while True:
g.run(1)
time.sleep(x)
When I run this script on Golly 3.0, it exits.
--Szymon Bartosiewicz
favorite pattern:
Code: Select all
x = 2, y = 2, rule = B25/S3a
2o$2o!
-
rowett
- Moderator
- Posts: 3821
- Joined: January 31st, 2013, 2:34 am
- Location: UK
-
Contact:
-
Quote
-
Login to like this post
Post
by rowett » December 1st, 2017, 5:27 pm
The int needs to be a float or x becomes 0 for any input less than 1000 at which point you call exit().
Also don't call exit() because it will exit the process. Perhaps use an else: for the while clause.
Oh and you'll need a call to g.update() after g.run(1) to refresh the display.
-
lifeisawesome
- Posts: 86
- Joined: April 22nd, 2016, 1:55 pm
- Location: poland
-
Quote
-
Login to like this post
Post
by lifeisawesome » December 4th, 2017, 10:55 am
Oh, exit() was the problem.
--Szymon Bartosiewicz
favorite pattern:
Code: Select all
x = 2, y = 2, rule = B25/S3a
2o$2o!