Page 1 of 1
Another Rulespace
Posted: August 24th, 2012, 8:44 am
by Hektor
During this summer, I thought of a rulespace in which every cells is counted depending on its state.
For example:
The center cell has four state 1 cells around, so its neighbors count is 1+1+1+1 = 4
The center cell has two state 1 and one state 2 cell around, its neighborhood count is 1+1+2 = 4
The center cell has three state 1 cells around, and is state 2 itself, so one additional neighbor is added 1+1+1+1 = 4
To discard ambiguity, the n state cells can be born only from a n-1 state cell, and so on...
The notation I thought for this rulespace is the following:
so in this example we have state 1 cells that behave like b3s23 and state 2 cells that is born from two state 1 cells and survives with two neighbors (b2s2)
I also wrote a python script that writes these ruletables, it's limited to two states, but I will generalize it in the future:
Code: Select all
#RuleTable writer
#23/08/12
#@hektor41
import golly as g
rule = g.getstring("Insert the rule","b3;3s23;23")
#Clean the file if already existing and then open it in append mode
open("/Applications/golly-2.4/Rules/{0}.table".format(rule), "w").write("")
table = open("/Applications/golly-2.4/Rules/{0}.table".format(rule), "a")
#Write the header
table.write("n_states:3\nneighborhood:Moore\nsymmetries:permute\n#Script-generated Ruletable\n")
ennad = "012345678"
survs = []
borns = []
death = []
def rule_format():
#Formats the born/survival rule for each state
bornrule = rule[1:rule.index("s")]
survrule = rule[rule.index("s")+1:len(rule)]
bidx = 0
sidx = 0
for br in xrange(0,len(bornrule)):
if bornrule[br] == ";":
borns.append(bornrule[bidx:br])
bidx += len(bornrule[bidx:br])+1
borns.append(bornrule[bidx:len(bornrule)])
for sr in xrange(0,len(survrule)):
if survrule[sr] == ";":
survs.append(survrule[sidx:sr])
sidx += len(survrule[sidx:sr])+1
survs.append(survrule[sidx:len(survrule)])
def death_format():
#Same but with death
for sr in xrange(0,len(survs)):
deathrule = ""
for x in xrange(0,len(ennad)):
if ennad[x] not in survs[sr]:
deathrule += ennad[x]
death.append(deathrule)
def createTransitions(total,start,final):
sub = []
for i in xrange(0,len(total)):
now = int(total[i])
if start > 1: # If the value of the central cell is > 1 then emulate an added neighbour by decreasing the total
now -= 1
s = "{0},{1}{2}{3}\n".format(start,"1,"*now,"0,"*(8-now),final) # Initially fills the string with 1*total
count = (s[1:].count("1,") + s[1:].count("2,")*2) # This is specific for TWO state automata!
while count == now:
if s not in sub:
sub.append(s)
s = s[0]+s[1:].replace("1,1,","2,0,",1) # Replace every occurrence of 1,1, with 2,0, // This is also specific and not general
count = (s[1:].count("1,") + s[1:].count("2,")*2) # Update the count
else:
break
return sub
#---------
rule_format()
death_format()
table.write("\n\n\n#Borns\n")
for bi in xrange(0,len(borns)):
for bx in createTransitions(borns[bi],bi,bi+1):
table.write(bx)
table.write("\n#Survs\n")
for si in xrange(0,len(survs)):
for sx in createTransitions(survs[si],si+1,si+1):
table.write(sx)
table.write("\n#Dies\n")
for di in xrange(0,len(death)):
for dx in createTransitions(death[di],di+1,0):
table.write(dx)
table.flush()
table.close()
g.setalgo("RuleTable")
g.setrule(rule)
Re: Another Rulespace
Posted: August 24th, 2012, 8:51 am
by Hektor
Some example rules:
b3;3s23;23 (double GoL)
I found an orthogonal c/2 and a diagonal c/10:
Code: Select all
x = 4, y = 10, rule = b3;3s23;23
A2.A$AB.A$A5$2A$AB$3A!
b3;3s23;23 (the first rule I explored)
An orthogonal c/2 and an orthogonal 2c/9:
Code: Select all
x = 6, y = 19, rule = b3;2s35;23
B.A$2.A$2.A$A.A10$2.2A$.B2AB$2A2.2A$3.A2$3.A!
b2;345s;23 (the state 1 cells behaves like b2/s)
Several seed-like orthogonal c/2:
Code: Select all
x = 35, y = 5, rule = b2;345s;23
.2A4.2A4.2A6.2A9.2A$6.A2.A5.A5.2B11.A$A2.A8.A18.A$32.3A$32.A!
EDIT: and a p/6 (I think) gun!
Code: Select all
x = 4, y = 6, rule = b2;345s;23
A2.A2$.2A$.2A2$A2.A!
b3;2s23;234
A diagonal c/38:
Code: Select all
x = 4, y = 3, rule = b3;2s23;234
A.A$A2.A$A!
Re: Another Rulespace
Posted: August 24th, 2012, 11:54 am
by EricG
Very interesting! I'm especially interested in this project, as it dovetails really nicely with something I've been working on.
The following pattern includes stable blobs, at least on my machine. Is this the intended outcome? (In other words, is it correct?) Relatedly, I see no 2,2,2,2,2,2,2,2,2,0 entry in the b3;3s23;23 ruletable -- should there be such an entry? Please let me know if I'm not understanding something.
Stable blobs
x = 43, y = 47, rule = b3;3s23;23
5$37.2B$34.6B$31.10B$30.11B$30.11B$31.4B3.2B2$25.2B5$15.B$15.B3$15.B$
14.B$25.2B5.B$24.4B2.2B$23.5B.4B$23.10B$23.9B$22.10B$22.6B.2B$22.9B$
21.9B$21.8B2.A$21.3B.3B$22.6B$24.3B11$41.A!
So,for a state 2 cell to survive when it has eight neighbors which are each state 2, wouldn't we need to specify something like S-sixteen? I'm not sure how the current notation would handle that. Again, let me know if I'm not understanding something.
Also, a very minor nitpick. I'm one of those people who keeps multiple versions of Golly open at the same time, so I changed my version of your script to put the ruletable file in the Golly Rules directory, instead of the directory for the Golly 2.4 distribution. This also makes it easier if/when Golly 2.5 is released, and I think it is how Golly's authors intended things to work.
open( g.getdir("rules")+"{0}.table".format(rule), "w").write("")
table = open(g.getdir("rules")+"{0}.table".format(rule), "a")
Additionally, I think you can just overwrite the ruletable by opening it, without erasing it first - I've been doing it like this f = open(golly.getdir("rules")+rule_name+".table", "w") I certainly don't know python, but I thought it wasn't a problem.
I'm looking forward to seeing how this project develops.
Re: Another Rulespace
Posted: August 24th, 2012, 1:52 pm
by Hektor
Thank's for the feedback, I really appreciate it.
Since I'm far from being an expert programmer, I surely have done some errors...
I first started looking into this Rulespace in a python program I wrote myself on holiday, and, since it worked in a completely different way from the Golly's ruletables, I did never thought that the neighborhood value could be higher than 8... The blobs you say shouldn't exist in b3;3s23;23. It won't be hard to correct it in the script, but we'll have to think something for the rule notation. We could use hexadecimal numbers (blobs -> b3;3s23;23F) but it would work only for a 3-state automation...
I would say that the lattice emulated by these rule is distant from the "normal" one like could be Margolus'.
Re: Another Rulespace
Posted: August 24th, 2012, 2:36 pm
by EricG
About notation: I've been working on various non-totalistic projects, and I've been using letters in the same way Alan Hensel and Paul Callahan did. For that reason, and also for increased readability for humans, my personal preference would be that letters aren't used to stand for numbers. Sometimes hexadecimal, etc, is really useful, of course, but for this application, I'd rather see base 10 numbers used to represent numbers.
Weighted Life uses this format:
RB5,RB19, RS2, RS3, RS15, RS16
The Weighted Life format could have been more condensed, like this:
B5,19/S2,3,15,16
Either way, the comma (",") is doing all the necessary work of separating numbers greater than 9.
About your overall idea:
First, I wonder if there if it would be easier to not count the central cell, and simply rely on the Birth/Survival rule specification. In Weighted Life, the ME value turned out to be superfluous; doesn't it here too?
Second, I'd be interested in a notation for an unweighted but otherwise similar rulespace where the rule B1x2/S23V (but in the Moore neighborhood) is a special case in a more general rulespace where State1 and State2 birth and survival rules and the way the two states interact with each other can be specified.
Re: Another Rulespace
Posted: August 25th, 2012, 9:52 am
by Hektor
First, I wonder if there if it would be easier to not count the central cell, and simply rely on the Birth/Survival rule specification. In Weighted Life, the ME value turned out to be superfluous; doesn't it here too?
No, that's an integrant part of the Rulespace! I'm sorry, maybe I didn't explained it clearly.
When a state 1 cell becomes state 2, it's neighborhood value increases by one, like a second cell was stacked upon the first.
My first idea was to simulate a "3d" space composed by stacked grids.
•On the first grid state 1 is born from void following certain rules (like this -> b
3;3;s23;23).
•When a state 1 cell satisfy a certain neighborhood value, (like this -> b3;
3;s23;23), a second cell is born on the second grid, just above the state 1 cell. Now, this process is simulated in Golly using multiple states. Two stacked cells count as two neighbors, therefore in golly every state 2 is like two stacked cells.
•The reason that state 2 cells count the central cell is because they are two! It's like having a ninth neighbor above.
For example a state 3 cell (that would be stacked upon a state 2 upon a state 1) would have a neighborhood value of three and it would count twice the central cell.
https://www.dropbox.com/s/hzmmhwvze87h3nt/Ca.png?m (state 2 cells are just two stacked state 1)
Re: Another Rulespace
Posted: October 9th, 2012, 10:08 am
by Hektor
Here's an update:
since I failed at writing a rule generator, I decided to manually write the general ruletable for this Rulespace.
Here's how it works:
•In the Life-like Rulespace, the next state of a cell is determined by the
number of neighbors,
but in this Rulespace the next state of a cell is determined by the
sum of the values of the near cells
•State-1 cells have value 1, they are counted normally, State-2 cells have value 2, so they add +1 to the neighborhood value sum
•A State-1 cell is born from a dead cell (State-0), a State-2 cell is born from a State-1 cell
Some examples:
The central cell has a neighborhood value = 8
The central cell has a neighborhood value = 9 because it counts twice
The central cell has a neighborhood value = 16 (8 * 2)
The central cell has a neighborhood value = 17 (8 * 2 + itself)
So,for a state 2 cell to survive when it has eight neighbors which are each state 2, wouldn't we need to specify something like S-sixteen? I'm not sure how the current notation would handle that.
That's a problem I haven't quite solved...
The rulestring needs to specify BORN1 for state 1, BORN2 for state 2, SURV1 for state-1, SURV2 for state-2,
BORN1 values can go from 0 to 16
BORN2 values can go from 0 to 16
SURV1 values can go from 0 to 16
SURV2 values can go from 1 to 17 (a lone State-2 cell count +1 to the neighborhood value)
So I'm currently using this notation: b(BORN1-BORN2)s(SURV1-SURV2)
i.e.
but it doesn't look that good...
(continue in the next post)
Re: Another Rulespace
Posted: October 9th, 2012, 10:27 am
by Hektor
Here are some rules:
Code: Select all
n_states:3
neighborhood:Moore
symmetries:permute
# UNAMED RULESPACE
# A state-0 cell counts as 0 cell
# A state-1 cell counts as 1 cell
# A state-2 cell counts as 2 cells, therefore it adds +1 to the neighbors count
# It can be extended to even
# Example rule: b(3-2)s(3,5-2,3)
# It means 0 becomes 1 when its neighborhood count is exactly 3
# 1 becomes 2 when its neighborhood count is exactly 2
# 1 survives when its neighborhood count is exactly 3 or 5
# 2 survives when its neighborhood count is exactly 2 or 3
# 0 >>> 1
# B0
0000000000
# B1
0100000000
# B2
0110000000
0200000000
# B3
0111000001
0210000001
# B4
0111100000
0211000000
0220000000
# B5
0111110000
0211100000
0221000000
# B6
0111111000
0211110000
0221100000
0222000000
# B7
0111111100
0211111000
0221110000
0222100000
# B8
0111111110
0211111100
0221111000
0222110000
0222200000
# B9
0211111110
0221111100
0222111000
0222210000
# B10
0221111110
0222111100
0222211000
0222220000
# B11
0222111110
0222211100
0222221000
# B12
0222211110
0222221100
0222222000
# B13
0222221110
0222222100
# B14
0222222110
0222222200
# B15
0222222210
# B16
0222222220
# 1 >>> 1 or 1 >>> 2
# S0 or B0
1000000000
# S1 or B1
1100000000
# S2 or B2
1110000002 # 2 is born
1200000002
# S3 or B3
1111000001
1210000001
# S4 or B4
1111100000
1211000000
1220000000
# S5 or B5
1111110001
1211100001
1221000001
# S6 or B6
1111111000
1211110000
1221100000
1222000000
# S7 or B7
1111111100
1211111000
1221110000
1222100000
# S8 or B8
1111111110
1211111100
1221111000
1222110000
1222200000
# S9 or B9
1211111110
1221111100
1222111000
1222210000
# S10 or B10
1221111110
1222111100
1222211000
1222220000
# S11 or B11
1222111110
1222211100
1222221000
# S12 or B12
1222211110
1222221100
1222222000
# S13 or B13
1222221110
1222222100
# S14 or B14
1222222110
1222222200
# S15 or B15
1222222210
# S16 or B16
1222222220
# 2 >>> 2
# S0 doesn't exist since a state-2 cell counts one addictional neighbors to the existing ones
2000000000
# S1
2000000000
# S2
2100000002
# S3
2110000002
2200000002
# S4
2111000000
2210000000
# S5
2111100000
2211000000
2220000000
# S6
2111110000
2211100000
2221000000
# S7
2111111000
2211110000
2221100000
2222000000
# S8
2111111100
2211111000
2221110000
2222100000
# S9
2111111110
2211111100
2221111000
2222110000
2222200000
# S10
2211111110
2221111100
2222111000
2222210000
# S11
2221111110
2222111100
2222211000
2222220000
# S12
2222111110
2222211100
2222221000
# S13
2222211110
2222221100
2222222000
# S14
2222221110
2222222100
# S15
2222222110
2222222200
# S16
2222222210
# S17
2222222220
And spaceships
Code: Select all
x = 21, y = 3, rule = b(3-2)s(3,5-2,3)
9.4A4.4A$.B$B.A6.A2.A4.A2.B!
An interesting rule is b(3-4)s(3-2,3):
Code: Select all
n_states:3
neighborhood:Moore
symmetries:permute
# UNAMED RULESPACE
# A state-0 cell counts as 0 cell
# A state-1 cell counts as 1 cell
# A state-2 cell counts as 2 cells, therefore it adds +1 to the neighbors count
# It can be extended to even
# Example rule: b(3-2)s(3,5-2,3)
# It means 0 becomes 1 when its neighborhood count is exactly 3
# 1 becomes 2 when its neighborhood count is exactly 2
# 1 survives when its neighborhood count is exactly 3 or 5
# 2 survives when its neighborhood count is exactly 2 or 3
# 0 >>> 1
# B0
0000000000
# B1
0100000000
# B2
0110000000
0200000000
# B3
0111000001
0210000001
# B4
0111100000
0211000000
0220000000
# B5
0111110000
0211100000
0221000000
# B6
0111111000
0211110000
0221100000
0222000000
# B7
0111111100
0211111000
0221110000
0222100000
# B8
0111111111
0211111101
0221111001
0222110001
0222200001
# B9
0211111110
0221111100
0222111000
0222210000
# B10
0221111110
0222111100
0222211000
0222220000
# B11
0222111110
0222211100
0222221000
# B12
0222211110
0222221100
0222222000
# B13
0222221110
0222222100
# B14
0222222110
0222222200
# B15
0222222210
# B16
0222222220
# 1 >>> 1 or 1 >>> 2
# S0 or B0
1000000000
# S1 or B1
1100000000
# S2 or B2
1110000000
1200000000
# S3 or B3
1111000001
1210000001
# S4 or B4
1111100002
1211000002
1220000002
# S5 or B5
1111110000
1211100000
1221000000
# S6 or B6
1111111000
1211110000
1221100000
1222000000
# S7 or B7
1111111100
1211111000
1221110000
1222100000
# S8 or B8
1111111110
1211111100
1221111000
1222110000
1222200000
# S9 or B9
1211111110
1221111100
1222111000
1222210000
# S10 or B10
1221111110
1222111100
1222211000
1222220000
# S11 or B11
1222111110
1222211100
1222221000
# S12 or B12
1222211110
1222221100
1222222000
# S13 or B13
1222221110
1222222100
# S14 or B14
1222222110
1222222200
# S15 or B15
1222222210
# S16 or B16
1222222220
# 2 >>> 2
# S0 doesn't exist since a state-2 cell counts one addictional neighbors to the existing ones
2000000000
# S1
2000000000
# S2
2100000002
# S3
2110000002
2200000002
# S4
2111000002
2210000002
# S5
2111100000
2211000000
2220000000
# S6
2111110000
2211100000
2221000000
# S7
2111111000
2211110000
2221100000
2222000000
# S8
2111111100
2211111000
2221110000
2222100000
# S9
2111111110
2211111100
2221111000
2222110000
2222200000
# S10
2211111110
2221111100
2222111000
2222210000
# S11
2221111110
2222111100
2222211000
2222220000
# S12
2222111110
2222211100
2222221000
# S13
2222211110
2222221100
2222222000
# S14
2222221110
2222222100
# S15
2222222110
2222222200
# S16
2222222210
# S17
2222222220
Code: Select all
x = 5, y = 4, rule = b(3-4)s(3-2,3)
.3A2$2.B$2.2A!
Maybe I'll write a program that automatically edits the basic ruletable, because it's very boring to do it manually...
Re: Another Rulespace
Posted: October 9th, 2012, 8:12 pm
by Tropylium
I'll need to read this topic thru again with more attention, but am I getting the gist right: basically this is a 2D emulation of a totalistic CA running on a 3D grid infinite in two directions but having a width of just two in another?
Re: Another Rulespace
Posted: October 10th, 2012, 7:15 am
by Hektor
I'll need to read this topic thru again with more attention, but am I getting the gist right: basically this is a 2D emulation of a totalistic CA running on a 3D grid infinite in two directions but having a width of just two in another?
Yes, that's the idea!
---
Here's b(4,6-2)s(1-)
Code: Select all
n_states:3
neighborhood:Moore
symmetries:permute
# UNAMED RULESPACE
# A state-0 cell counts as 0 cell
# A state-1 cell counts as 1 cell
# A state-2 cell counts as 2 cells, therefore it adds +1 to the neighbors count
# It can be extended to even
# Example rule: b(3-2)s(3,5-2,3)
# It means 0 becomes 1 when its neighborhood count is exactly 3
# 1 becomes 2 when its neighborhood count is exactly 2
# 1 survives when its neighborhood count is exactly 3 or 5
# 2 survives when its neighborhood count is exactly 2 or 3
# 0 >>> 1
# B0
0000000000
# B1
0100000000
# B2
0110000000
0200000000
# B3
0111000000
0210000000
# B4
0111100001
0211000001
0220000001
# B5
0111110000
0211100000
0221000000
# B6
0111111001
0211110001
0221100001
0222000001
# B7
0111111100
0211111000
0221110000
0222100000
# B8
0111111110
0211111100
0221111000
0222110000
0222200000
# B9
0211111110
0221111100
0222111000
0222210000
# B10
0221111110
0222111100
0222211000
0222220000
# B11
0222111110
0222211100
0222221000
# B12
0222211110
0222221100
0222222000
# B13
0222221110
0222222100
# B14
0222222110
0222222200
# B15
0222222210
# B16
0222222220
# 1 >>> 1 or 1 >>> 2
# S0 or B0
1000000000
# S1 or B1
1100000001
# S2 or B2
1110000002
1200000002
# S3 or B3
1111000000
1210000000
# S4 or B4
1111100000
1211000000
1220000000
# S5 or B5
1111110000
1211100000
1221000000
# S6 or B6
1111111000
1211110000
1221100000
1222000000
# S7 or B7
1111111100
1211111000
1221110000
1222100000
# S8 or B8
1111111110
1211111100
1221111000
1222110000
1222200000
# S9 or B9
1211111110
1221111100
1222111000
1222210000
# S10 or B10
1221111110
1222111100
1222211000
1222220000
# S11 or B11
1222111110
1222211100
1222221000
# S12 or B12
1222211110
1222221100
1222222000
# S13 or B13
1222221110
1222222100
# S14 or B14
1222222110
1222222200
# S15 or B15
1222222210
# S16 or B16
1222222220
# 2 >>> 2
# S0 doesn't exist since a state-2 cell counts one addictional neighbors to the existing ones
2000000000
# S1
2000000000
# S2
2100000000
# S3
2110000000
2200000000
# S4
2111000000
2210000000
# S5
2111100000
2211000000
2220000000
# S6
2111110000
2211100000
2221000000
# S7
2111111000
2211110000
2221100000
2222000000
# S8
2111111100
2211111000
2221110000
2222100000
# S9
2111111110
2211111100
2221111000
2222110000
2222200000
# S10
2211111110
2221111100
2222111000
2222210000
# S11
2221111110
2222111100
2222211000
2222220000
# S12
2222111110
2222211100
2222221000
# S13
2222211110
2222221100
2222222000
# S14
2222221110
2222222100
# S15
2222222110
2222222200
# S16
2222222210
# S17
2222222220
And a small B5 that works in most of the rules with b(4,6x-2x)
Code: Select all
x = 2, y = 2, rule = b(4,6-2)s(1-)
A$2A!
However I haven't found many interesting things...
Re: Another Rulespace
Posted: October 10th, 2012, 3:01 pm
by Tropylium
Hektor wrote:I'll need to read this topic thru again with more attention, but am I getting the gist right: basically this is a 2D emulation of a totalistic CA running on a 3D grid infinite in two directions but having a width of just two in another?
Yes, that's the idea!
In that case, this is an area I've kind of looked around as well — altho I initially approached this from the direction of using "half cells".
It does not seem to follow from the concept that state-2 cells should only be born from state-1 cells. If the two stacked cells are to be considered truly equal (and their neighborhood does comprise of the same 16 cells + each other), then if N "external" neighbors allows one of them to be born, the same neighbors should allow the birth of the other one as well. So this actually allows no way whatsoever to create state-1 cells.
Your solution apparently is that the "upper" grid can only be populated once the "lower" grid has been, but the "upper" grid can still affect all adjacent lower grid cells, and thus patterns comprise mostly of state-1 cells with occasional state-2?
I took the opposite route: considering state-2 cells as the basic (since they are, after all, what strict adherence to isotropy would generate) and state-1 cells as the "additions". More details on this later, I'll need to dig up my notes…
A third solution that retains full equivalence might be to use a neighborhood smaller than a full cube by cutting out the corner cells (leaving 18 neighbors in a general 3D environment, 13 in this case). But here we would need to divide state 1 cells into two subtypes depending on which layer they are on.