The program runs fine, but nothing changes...
Where am I wrong?
Code: Select all
import golly as g
import random
numB = random.randint(0,9) #The number of rules for a cell to be born. For example b123/... has three rules
numS = random.randint(0,9) #Same with survival rules. b.../s012345678 has nine rules
borns = ["0","1","2","3","4","5","6","7","8"]
survs = ["0","1","2","3","4","5","6","7","8"]
b = []
s = []
for i in xrange(0,numB):
newb = random.choice(borns) #Choose a number from all the possible number of neighbours
borns.remove(newb) #Removes it from the list for preventing duplicates like b33/s23
b.append(newb) #Append the number to b
for j in xrange(0,numB):
news = random.choice(survs)
survs.remove(news)
s.append(news)
b.sort() #Sort numerically the lists
s.sort()
b = "".join(b) #Make strings from them
s = "".join(s)
rule = "b{0}/s{1}".format(str(b),str(s))
g.exit(rule)
g.setrule(rule)