A forum for topics that don't fit elsewhere. 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. Forum rules still apply.
So the purpose of this is to make a Python script that can generate a rule. I've made a (bad) one that requires manual inspecting as duplicates can often happen(also, for some reason it prints up to a certain number:
#Random rule
#Not Including Hensel notation
#0-8:
import random
basic_notation = ['0','1','2','3','4','5','6','7','8']
for y in range(1,10):
B = []
S = []
for x in range(0, random.randint(1,8)):
B.append(basic_notation[random.randint(0,8)])
for x in range(0, random.randint(1,8)):
S.append(basic_notation[random.randint(0,8)])
print('B')
for BItem in range(0, len(B)):
print(BItem)
print('S')
for SItem in range(0, len(S)):
print(SItem)
print('==============================')
And I posted this in the Sandbox forum because the Scripts forum says 'For scripts to aid with computation or simulation in cellular automata.' which doesn't fit a random rule generator...
NoAyeBeardo wrote: September 14th, 2020, 1:14 pm
So the purpose of this is to make a Python script that can generate a rule. I've made a (bad) one that requires manual inspecting as duplicates can often happen(also, for some reason it prints up to a certain number:
#Random rule
#Not Including Hensel notation
#0-8:
import random
basic_notation = ['0','1','2','3','4','5','6','7','8']
for y in range(1,10):
B = []
S = []
for x in range(0, random.randint(1,8)):
B.append(basic_notation[random.randint(0,8)])
for x in range(0, random.randint(1,8)):
S.append(basic_notation[random.randint(0,8)])
print('B')
for BItem in range(0, len(B)):
print(BItem)
print('S')
for SItem in range(0, len(S)):
print(SItem)
print('==============================')
And I posted this in the Sandbox forum because the Scripts forum says 'For scripts to aid with computation or simulation in cellular automata.' which doesn't fit a random rule generator...
it doesn't do anything when I run it
I was so socially awkward in the past and it will haunt me for the rest of my life.
#Random rule
#Not Including Hensel notation
import golly as g
import random
birth_letters = ("3", "4", "5", "6", "7", "8")
survival_letters = ("0", "1", "2", "3", "4", "5", "6", "7", "8")
rulestr = "B"
for y in range (0, random.randint(1, 6)):
rulestr += random.choice(birth_letters)
rulestr += "/S"
for y in range (0, random.randint(1, 8)):
rulestr += random.choice(survival_letters)
g.setrule(rulestr)
Well the thing is that (I didn't mention this) I wanted to do it without the 'import golly as g' thing, as my python doesn't recognise it. However, I did change goldenratio's script to be without Golly commands(and truly random):
NoAyeBeardo wrote: September 15th, 2020, 12:27 pm
Well the thing is that (I didn't mention this) I wanted to do it without the 'import golly as g' thing, as my python doesn't recognise it. However, I did change goldenratio's script to be without Golly commands(and truly random):
NoAyeBeardo wrote: September 15th, 2020, 12:27 pm
Well the thing is that (I didn't mention this) I wanted to do it without the 'import golly as g' thing, as my python doesn't recognise it. However, I did change goldenratio's script to be without Golly commands(and truly random):