I have made a script to generate these but it only takes totalistic rules for now (unless someone wants to help me make the transition generator)

Code: Select all

```
# altRuleGen.py
# Script to generate alternating totalistic rules.
# By Saka
#NEVER ENTER B0
import golly as g
import os
r = g.getstring("Rule? Enter in format Bx_Sx-Bx_Sx","B3_S23-B36_S23")
rules = r.split("-")
rule1 = rules[0].split("_")
rule2 = rules[1].split("_")
br1 = rule1[0].translate(None, "B")
sr1 = rule1[1].translate(None, "S")
br2 = rule2[0].translate(None, "B")
sr2 = rule2[1].translate(None, "S")
trans1 = {
"0": ",0,0,0,0,0,0,0,0,2",
"1": ",1,0,0,0,0,0,0,0,2",
"2": ",1,1,0,0,0,0,0,0,2",
"3": ",1,1,1,0,0,0,0,0,2",
"4": ",1,1,1,1,0,0,0,0,2",
"5": ",1,1,1,1,1,0,0,0,2",
"6": ",1,1,1,1,1,1,0,0,2",
"7": ",1,1,1,1,1,1,1,0,2",
"8": ",1,1,1,1,1,1,1,1,2"
}
trans2 = {
"0": ",0,0,0,0,0,0,0,0,1",
"1": ",2,0,0,0,0,0,0,0,1",
"2": ",2,2,0,0,0,0,0,0,1",
"3": ",2,2,2,0,0,0,0,0,1",
"4": ",2,2,2,2,0,0,0,0,1",
"5": ",2,2,2,2,2,0,0,0,1",
"6": ",2,2,2,2,2,2,0,0,1",
"7": ",2,2,2,2,2,2,2,0,1",
"8": ",2,2,2,2,2,2,2,2,1"
}
def genTransitions(B,S):
t = []
for i in range(0,len(B)):
t.append("0" + trans1[B[i]])
for i in range(0,len(S)):
t.append("1" + trans1[S[i]])
return t
def genTransitions2(B,S):
t = []
for i in range(0,len(B)):
t.append("0" + trans2[B[i]])
for i in range(0,len(S)):
t.append("2" + trans2[S[i]])
return t
def makeRuleTable(ruleName,nStates,neighborhood,symmetries,transitionsList):
rule = '@RULE '+ruleName+'\n\n'
table = '@TABLE\n'+'n_states:'+str(nStates)+'\n'+'neighborhood:'+neighborhood+'\n'+'symmetries:'+symmetries+'\n'
transitions = '\n'
for i in range(0,len(transitionsList)):
transitions = transitions+str(transitionsList[i])+'\n'
i += 1
return rule+table+transitions
trans = []
trans.append("var a={0,1,2}")
trans.append("var b=a")
trans.append("var c=a")
trans.append("var d=a")
trans.append("var e=a")
trans.append("var f=a")
trans.append("var g=a")
trans.append("var h=a")
trans.append("#Rule 1")
trans.extend(genTransitions(br1,sr1))
trans.append("1,a,b,c,d,e,f,g,h,0")
trans.append("#Rule 2")
trans.extend(genTransitions2(br2,sr2))
trans.append("2,a,b,c,d,e,f,g,h,0")
theRule = makeRuleTable(r,3,"Moore","permute",trans)
def saverule(name,ruleFile):
ruledir = g.getdir("rules")
filename = ruledir + name + ".rule"
# Only create a rule file if it doesn't already exist.
if not os.path.exists(filename):
try:
f = open(filename, 'w')
f.write(ruleFile)
f.close()
except:
g.warn("Unable to create rule table:\n" + filename)
saverule(r,theRule)
g.setrule(r)
g.show("Rule " + r + " succesfuly created")
```

3c/4o in an explosive rule

Code: Select all

```
x = 5, y = 10, rule = B3_S23-B2_3
.A.A$2A.2A$2A.2A$A3.A3$A3.A3$.A.A!
```

Code: Select all

```
x = 7, y = 5, rule = B3_S23-B2_S78
.2A.2A3$A5.A$.5A!
```

Code: Select all

```
x = 2, y = 3, rule = B3_S23-B1_S
B$2B$2B!
```

Code: Select all

```
x = 4, y = 6, rule = B3_S3-B2_S2
2A$3A$.2A$A.A$3.A$3.A!
```

Code: Select all

```
x = 6, y = 6, rule = B3_S23-B35_S23
4.2A$4.2A2$3A$A.A$2A!
```

Code: Select all

```
x = 11, y = 16, rule = B3_S23-B35_S23
6.2A$6.2A3$9.2A$8.2A5$.2A$2A3$3.2A$3.2A!
```