C# Extended Neighborhood Emulator Script

For scripts to aid with computation or simulation in cellular automata.
Post Reply
pi_guy314
Posts: 88
Joined: July 21st, 2014, 9:45 pm

C# Extended Neighborhood Emulator Script

Post by pi_guy314 » June 5th, 2017, 11:12 pm

This script will generate a rule-table that emulates any totalistic rule in a radius-2 disc (radius 2 Moore without corners) neighborhood. There's still a few things that need to be fixed, such as the rule table being excessively big. Keep in mind that mixing the on-state with count-states will result in weird, unintended behaviors.

Here's an example of the B4/S2,3 rule table

Code: Select all

@RULE B4_S2,3_D2

States:
00 OFF / OFF_COUNT_0
01 ON
02 OFF_COUNT_1
...
09 OFF_COUNT_8
10 ON_COUNT_0
...
18 ON_COUNT_8

@TABLE
n_states:19
neighborhood:Moore
symmetries:rotate4reflect

#all states
var a0 = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18}
var a1 = a0
var a2 = a0
var a3 = a0
var a4 = a0
var a5 = a0
var a6 = a0
var a7 = a0

#all of the off-counts states
var 0c0 = {0,2,3,4,5,6,7,8,9}
var 0c1 = 0c0
var 0c2 = 0c0
var 0c3 = 0c0
var 0c4 = 0c0

#all of the on-count states
var 1c0 = {10,11,12,13,14,15,16,17,18}
var 1c1 = 1c0
var 1c2 = 1c0
var 1c3 = 1c0
var 1c4 = 1c0

#OFF -> OFF_COUNT_1 when there's 1 neighbor
0,1,0,0,0,0,0,0,0,2
0,0,1,0,0,0,0,0,0,2
#OFF -> OFF_COUNT_2 when there's 2 neighbors
0,1,1,0,0,0,0,0,0,3
0,1,0,1,0,0,0,0,0,3
0,1,0,0,1,0,0,0,0,3
0,1,0,0,0,1,0,0,0,3
0,0,1,0,1,0,0,0,0,3
0,0,1,0,0,0,1,0,0,3
#OFF -> OFF_COUNT_3 when there's 3 neighbors
0,1,1,1,0,0,0,0,0,4
0,1,1,0,1,0,0,0,0,4
0,1,1,0,0,1,0,0,0,4
0,1,1,0,0,0,1,0,0,4
0,1,1,0,0,0,0,1,0,4
0,1,1,0,0,0,0,0,1,4
0,1,0,1,0,1,0,0,0,4
0,1,0,1,0,0,1,0,0,4
0,1,0,0,1,0,1,0,0,4
0,0,1,0,1,0,1,0,0,4
#OFF -> OFF_COUNT_4 when there's 4 neighbors
0,1,1,1,1,0,0,0,0,5
0,1,1,1,0,1,0,0,0,5
0,1,1,1,0,0,1,0,0,5
0,1,1,0,1,1,0,0,0,5
0,1,1,0,1,0,1,0,0,5
0,1,1,0,1,0,0,1,0,5
0,1,1,0,1,0,0,0,1,5
0,1,1,0,0,1,1,0,0,5
0,1,1,0,0,1,0,1,0,5
0,1,1,0,0,1,0,0,1,5
0,1,1,0,0,0,1,1,0,5
0,1,0,1,0,1,0,1,0,5
0,0,1,0,1,0,1,0,1,5
#ON -> OFF_COUNT_5 when there's 5 neighbors
0,1,1,1,1,1,0,0,0,6
0,1,1,1,1,0,1,0,0,6
0,1,1,1,1,0,0,1,0,6
0,1,1,1,1,0,0,0,1,6
0,1,1,1,0,1,1,0,0,6
0,1,1,1,0,1,0,1,0,6
0,1,1,0,1,1,1,0,0,6
0,1,1,0,1,1,0,1,0,6
0,1,1,0,1,0,1,1,0,6
0,1,1,0,1,0,1,0,1,6
#OFF -> OFF_COUNT_6 when there's 6 neighbors
0,1,1,1,1,1,1,0,0,7
0,1,1,1,1,1,0,1,0,7
0,1,1,1,1,0,1,1,0,7
0,1,1,1,1,0,1,0,1,7
0,1,1,1,0,1,1,1,0,7
0,1,1,0,1,1,1,0,1,7
#OFF -> OFF_COUNT_7 when there's 7 neighbors
0,1,1,1,1,1,1,1,0,8
0,1,1,1,1,1,1,0,1,8
#OFF -> OFF_COUNT_8 when there's 8 neighbors
0,1,1,1,1,1,1,1,1,9
#ON -> ON_COUNT_0 where there's 0 neighbor
1,0,0,0,0,0,0,0,0,10
#ON -> ON_COUNT_1 where there's 1 neighbor
1,1,0,0,0,0,0,0,0,11
1,0,1,0,0,0,0,0,0,11
#ON -> ON_COUNT_2 where there's 2 neighbors
1,1,1,0,0,0,0,0,0,12
1,1,0,1,0,0,0,0,0,12
1,1,0,0,1,0,0,0,0,12
1,1,0,0,0,1,0,0,0,12
1,0,1,0,1,0,0,0,0,12
1,0,1,0,0,0,1,0,0,12
#ON -> ON_COUNT_2 where there's 3 neighbors
1,1,1,1,0,0,0,0,0,13
1,1,1,0,1,0,0,0,0,13
1,1,1,0,0,1,0,0,0,13
1,1,1,0,0,0,1,0,0,13
1,1,1,0,0,0,0,1,0,13
1,1,1,0,0,0,0,0,1,13
1,1,0,1,0,1,0,0,0,13
1,1,0,1,0,0,1,0,0,13
1,1,0,0,1,0,1,0,0,13
1,0,1,0,1,0,1,0,0,13
#ON -> ON_COUNT_4 where there's 4 neighbors
1,1,1,1,1,0,0,0,0,14
1,1,1,1,0,1,0,0,0,14
1,1,1,1,0,0,1,0,0,14
1,1,1,0,1,1,0,0,0,14
1,1,1,0,1,0,1,0,0,14
1,1,1,0,1,0,0,1,0,14
1,1,1,0,1,0,0,0,1,14
1,1,1,0,0,1,1,0,0,14
1,1,1,0,0,1,0,1,0,14
1,1,1,0,0,1,0,0,1,14
1,1,1,0,0,0,1,1,0,14
1,1,0,1,0,1,0,1,0,14
1,0,1,0,1,0,1,0,1,14
#ON -> ON_COUNT_5 where there's 5 neighbors
1,1,1,1,1,1,0,0,0,15
1,1,1,1,1,0,1,0,0,15
1,1,1,1,1,0,0,1,0,15
1,1,1,1,1,0,0,0,1,15
1,1,1,1,0,1,1,0,0,15
1,1,1,1,0,1,0,1,0,15
1,1,1,0,1,1,1,0,0,15
1,1,1,0,1,1,0,1,0,15
1,1,1,0,1,0,1,1,0,15
1,1,1,0,1,0,1,0,1,15
#ON -> ON_COUNT_6 where there's 6 neighbors
1,1,1,1,1,1,1,0,0,16
1,1,1,1,1,1,0,1,0,16
1,1,1,1,1,0,1,1,0,16
1,1,1,1,1,0,1,0,1,16
1,1,1,1,0,1,1,1,0,16
1,1,1,0,1,1,1,0,1,16
#ON -> ON_COUNT_7 where there's 7 neighbors
1,1,1,1,1,1,1,1,0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1
1c0,12,0c1,4,0c2,12,0c3,13,0c4,1
1c0,3,1c1,3,0c2,3,1c3,4,0c4,1
1c0,4,1c1,3,0c2,3,1c3,4,1c4,1
1c0,4,1c1,3,0c2,4,1c3,12,0c4,1
1c0,3,1c1,3,0c2,3,0c3,3,0c4,1
1c0,4,1c1,3,0c2,3,0c3,3,1c4,1
1c0,4,1c1,3,0c2,4,0c3,11,0c4,1
1c0,4,1c1,4,0c2,11,0c3,4,1c4,1
1c0,4,1c1,4,0c2,12,0c3,12,0c4,1


#overridable
#COUNT_STATES -> OFF
1c0,a0,a1,a2,a3,a4,a5,a6,a7,0
0c0,a0,a1,a2,a3,a4,a5,a6,a7,0
@COLORS
00 0 0 0
01 250 250 250
02 50 50 50
03 50 50 50
04 50 50 50
05 50 50 50
06 50 50 50
07 50 50 50
08 50 50 50
09 50 50 50
10 200 200 200
11 200 200 200
12 200 200 200
13 200 200 200
14 200 200 200
15 200 200 200
16 200 200 200
17 200 200 200
18 200 200 200
The rule itself isn't very interesting, but its the only one I found that isn't completely boring. There's one spaceship and very few still lives and oscillators. It's pretty tedious looking for rules, but there's likely one that's interesting enough.

Link to the Github Repository: https://github.com/ThatSoundsFun/extend ... d_emulator

EDIT: Changed the rule from B4/S2,3,4 to B4/S2,3 as it had another oscillator. (June 25, 17)
Last edited by pi_guy314 on June 25th, 2017, 6:08 pm, edited 2 times in total.

wildmyron
Posts: 1397
Joined: August 9th, 2013, 12:45 am

Re: C# Extended Neighborhood Emulator Script

Post by wildmyron » June 6th, 2017, 5:59 am

pi_guy314 wrote:This script will generate a rule-table that emulates any totalistic rule in a radius-2 disc (radius 2 Moore without corners) neighborhood.
Nice work, I think it will be quite interesting to explore more of the rules with larger neighbourhoods, though it does seem to become harder to sift through the enourmous rulespaces that result.
pi_guy314 wrote:There's still a few things that need to be fixed, such as the rule table being excessively big. Keep in mind that mixing the on-state with count-states will result in weird, unintended behaviors.
Taking advantage of the rotate4reflect symmetry will certainly help a lot. Is there possibly more redundancy in the ruletable which could be removed to reduce the size?
pi_guy314 wrote:It's pretty tedious looking for rules, but there's likely one that's interesting enough.
This is probably one of those areas where a program which natively supports larger neighbourhoods would be much easier to use to explore the rulespace. @bprentice's Java Square Cell allows easier exploration of the rulespace. Here's a small pattern collection in sqc format:

Code: Select all

#Rule = Rule Table
#States = 2
#Counts = 21
#SW 0,1
#NW 0,1,1,1,0
#NW 1,1,1,1,1
#NW 1,1,0,1,1
#NW 1,1,1,1,1
#NW 0,1,1,1,0
#RT 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
#RT 0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
#Rows = 13
#Columns = 33
#L .A$.2A$A8$3A7.2A8.2A9.A$12.A7.A9.A$32.A
If you load this pattern in Square Cell the neighbourhood will be setup to be a radius 2 Disc. (You may need to Ctrl-click to place the selection in the world.) Then press 'n' to test a new random rule in the rulespace. Press 'r' to randomise the world without changing the rule.

The most interesting rule I have found so far is B4,10,12,14/S3,4,10,12,13_D2

Here's a small pattern collection:

Code: Select all

#Rule = Rule Table
#States = 2
#Counts = 21
#SW 0,1
#NW 0,1,1,1,0
#NW 1,1,1,1,1
#NW 1,1,0,1,1
#NW 1,1,1,1,1
#NW 0,1,1,1,0
#RT 0,0,0,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,0,0,0
#RT 0,0,0,1,1,0,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0
#Rows = 23
#Columns = 13
#L 3A$2.A$3A7$A.A7.A.A$.A8.A$A.A7.A.A7$11.2A$.A9.A$A$2.2A7.2A$2.A
I was hoping to generate a Golly ruletable but haven't been able to build the project (I'm using VS2010 and apparently I don't have Newtonsoft.Json)
The latest version of the 5S Project contains over 226,000 spaceships. There is also a GitHub mirror of the collection. Tabulated pages up to period 160 (out of date) are available on the LifeWiki.

pi_guy314
Posts: 88
Joined: July 21st, 2014, 9:45 pm

Re: C# Extended Neighborhood Emulator Script

Post by pi_guy314 » June 6th, 2017, 4:46 pm

Taking advantage of the rotate4reflect symmetry will certainly help a lot. Is there possibly more redundancy in the ruletable which could be removed to reduce the size?
Detecting whether transitions are rotations/reflections of another transition seems hard to do, but I'll still try. I've also noticed that there's a lot of duplicate lines produced. Maybe fixing that will be enough to generate files that are at a reasonable size.
The most interesting rule I have found so far is B4,10,12,14/S3,4,10,12,13_D2
I tried generating that rule, but there's a few problems I faced. The file generated is extremely big. It's 10,833kbs. Another problem is that Golly is very slow running the pattern. It could be the size of the file. Does Golly optimize rule tables before using it? And the worst problem is that the rule is invalid. The rule itself isn't producing the same patterns as the one you showed. The first rule I posted seemed valid.
I was hoping to generate a Golly ruletable but haven't been able to build the project (I'm using VS2010 and apparently I don't have Newtonsoft.Json)
There is a zip file with the executable along with the release. https://github.com/ThatSoundsFun/extend ... r/releases

User avatar
BlinkerSpawn
Posts: 1964
Joined: November 8th, 2014, 8:48 pm
Location: Getting a snacker from R-Bee's

Re: C# Extended Neighborhood Emulator Script

Post by BlinkerSpawn » June 6th, 2017, 5:30 pm

pi_guy314 wrote:The file generated is extremely big. It's 10,833kbs.
So you have a .rule file that's 10,833KB in size for B4ace/S34acd (using letters to represent numbers a la base-36 here).
Selecting 10 neighbors out of 21 for Ba and Sa = 352,716 possibilities each (705,432 in total)
Making one .rule line for each of these (C,N,NE,E,...,W,NW,C') = 705,432 * at least 17 characters per line >= 11,992,344 bytes > 11,711KB.
That's just two transitions.
Sounds like the table is decently condensed already.
LifeWiki: Like Wikipedia but with more spaceships. [citation needed]

Image

pi_guy314
Posts: 88
Joined: July 21st, 2014, 9:45 pm

Re: C# Extended Neighborhood Emulator Script

Post by pi_guy314 » June 6th, 2017, 10:42 pm

I believe I now fixed the script now. Turns out that it was an off-by-1 bug that caused it. I also reduced the size tremendously by removing all of the duplicate lines. The first rule posted went from 286KB to 72KB and the second one went from 10,833KB to 1,456KB. Golly can also run the rule a lot quicker now.

Here's the golly rule-table of B4,10,12,14/S3,4,10,12,13_D2: https://gist.github.com/anonymous/4d680 ... e3aa59172e
Last edited by pi_guy314 on June 8th, 2017, 2:25 pm, edited 1 time in total.

wildmyron
Posts: 1397
Joined: August 9th, 2013, 12:45 am

Re: C# Extended Neighborhood Emulator Script

Post by wildmyron » June 7th, 2017, 2:25 am

pi_guy314 wrote:I believe I now fixed the script now. Turns out that it was an off-by-1 bug that caused it. I also reduced the size tremendously by removing all of the duplicate lines. The first rule posted also went from 286KB to 72KB and the second one went from 10,833KB to 1,456KB. Golly can also run the rule a lot quicker now.

Here's the golly rule-table of B4,10,12,14/S3,4,10,12,13_D2: https://gist.github.com/anonymous/4d680 ... e3aa59172e
This looks good - it seems to have the same dynamics as I observed in SquareCell.

Thank you also for providing the executable - I see you've updated the release.
pi_guy314 wrote:
Taking advantage of the rotate4reflect symmetry will certainly help a lot. Is there possibly more redundancy in the ruletable which could be removed to reduce the size?
Detecting whether transitions are rotations/reflections of another transition seems hard to do, but I'll still try.
Rather than trying to detect if a transition is a rotation / reflection of a previous transition, it might be possible to modify PermuteBits() to only return permutations which aren't rotations / reflections of each other. The transitions in the template are probably the easiest (but also least impact on file size). Did you autogenerate them with the Grid and Permute class? If so that could be a good test of modification to the Permute class to ensure all required transitions are generated.

Actually, the required set of transitions for the template can be generated with isotropic-rule-gen.py by generating the rule for B12345678/S012345678 and then modifying the result states as required. Here's the result of this process:

Code: Select all

#OFF -> OFF_COUNT_1 when there's 1 neighbor
0,1,0,0,0,0,0,0,0,2
0,0,1,0,0,0,0,0,0,2
#OFF -> OFF_COUNT_2 when there's 2 neighbors
0,1,1,0,0,0,0,0,0,3
0,1,0,1,0,0,0,0,0,3
0,1,0,0,1,0,0,0,0,3
0,1,0,0,0,1,0,0,0,3
0,0,1,0,1,0,0,0,0,3
0,0,1,0,0,0,1,0,0,3
#OFF -> OFF_COUNT_3 when there's 3 neighbors
0,1,1,1,0,0,0,0,0,4
0,1,1,0,1,0,0,0,0,4
0,1,1,0,0,1,0,0,0,4
0,1,1,0,0,0,1,0,0,4
0,1,1,0,0,0,0,1,0,4
0,1,1,0,0,0,0,0,1,4
0,1,0,1,0,1,0,0,0,4
0,1,0,1,0,0,1,0,0,4
0,1,0,0,1,0,1,0,0,4
0,0,1,0,1,0,1,0,0,4
#OFF -> OFF_COUNT_4 when there's 4 neighbors
0,1,1,1,1,0,0,0,0,5
0,1,1,1,0,1,0,0,0,5
0,1,1,1,0,0,1,0,0,5
0,1,1,0,1,1,0,0,0,5
0,1,1,0,1,0,1,0,0,5
0,1,1,0,1,0,0,1,0,5
0,1,1,0,1,0,0,0,1,5
0,1,1,0,0,1,1,0,0,5
0,1,1,0,0,1,0,1,0,5
0,1,1,0,0,1,0,0,1,5
0,1,1,0,0,0,1,1,0,5
0,1,0,1,0,1,0,1,0,5
0,0,1,0,1,0,1,0,1,5
#ON -> OFF_COUNT_5 when there's 5 neighbors
0,1,1,1,1,1,0,0,0,6
0,1,1,1,1,0,1,0,0,6
0,1,1,1,1,0,0,1,0,6
0,1,1,1,1,0,0,0,1,6
0,1,1,1,0,1,1,0,0,6
0,1,1,1,0,1,0,1,0,6
0,1,1,0,1,1,1,0,0,6
0,1,1,0,1,1,0,1,0,6
0,1,1,0,1,0,1,1,0,6
0,1,1,0,1,0,1,0,1,6
#OFF -> OFF_COUNT_6 when there's 6 neighbors
0,1,1,1,1,1,1,0,0,7
0,1,1,1,1,1,0,1,0,7
0,1,1,1,1,0,1,1,0,7
0,1,1,1,1,0,1,0,1,7
0,1,1,1,0,1,1,1,0,7
0,1,1,0,1,1,1,0,1,7
#OFF -> OFF_COUNT_7 when there's 7 neighbors
0,1,1,1,1,1,1,1,0,8
0,1,1,1,1,1,1,0,1,8
#OFF -> OFF_COUNT_8 when there's 8 neighbors
0,1,1,1,1,1,1,1,1,9
#ON -> ON_COUNT_0 where there's 0 neighbor
1,0,0,0,0,0,0,0,0,10
#ON -> ON_COUNT_1 where there's 1 neighbor
1,1,0,0,0,0,0,0,0,11
1,0,1,0,0,0,0,0,0,11
#ON -> ON_COUNT_2 where there's 2 neighbors
1,1,1,0,0,0,0,0,0,12
1,1,0,1,0,0,0,0,0,12
1,1,0,0,1,0,0,0,0,12
1,1,0,0,0,1,0,0,0,12
1,0,1,0,1,0,0,0,0,12
1,0,1,0,0,0,1,0,0,12
#ON -> ON_COUNT_2 where there's 3 neighbors
1,1,1,1,0,0,0,0,0,13
1,1,1,0,1,0,0,0,0,13
1,1,1,0,0,1,0,0,0,13
1,1,1,0,0,0,1,0,0,13
1,1,1,0,0,0,0,1,0,13
1,1,1,0,0,0,0,0,1,13
1,1,0,1,0,1,0,0,0,13
1,1,0,1,0,0,1,0,0,13
1,1,0,0,1,0,1,0,0,13
1,0,1,0,1,0,1,0,0,13
#ON -> ON_COUNT_4 where there's 4 neighbors
1,1,1,1,1,0,0,0,0,14
1,1,1,1,0,1,0,0,0,14
1,1,1,1,0,0,1,0,0,14
1,1,1,0,1,1,0,0,0,14
1,1,1,0,1,0,1,0,0,14
1,1,1,0,1,0,0,1,0,14
1,1,1,0,1,0,0,0,1,14
1,1,1,0,0,1,1,0,0,14
1,1,1,0,0,1,0,1,0,14
1,1,1,0,0,1,0,0,1,14
1,1,1,0,0,0,1,1,0,14
1,1,0,1,0,1,0,1,0,14
1,0,1,0,1,0,1,0,1,14
#ON -> ON_COUNT_5 where there's 5 neighbors
1,1,1,1,1,1,0,0,0,15
1,1,1,1,1,0,1,0,0,15
1,1,1,1,1,0,0,1,0,15
1,1,1,1,1,0,0,0,1,15
1,1,1,1,0,1,1,0,0,15
1,1,1,1,0,1,0,1,0,15
1,1,1,0,1,1,1,0,0,15
1,1,1,0,1,1,0,1,0,15
1,1,1,0,1,0,1,1,0,15
1,1,1,0,1,0,1,0,1,15
#ON -> ON_COUNT_6 where there's 6 neighbors
1,1,1,1,1,1,1,0,0,16
1,1,1,1,1,1,0,1,0,16
1,1,1,1,1,0,1,1,0,16
1,1,1,1,1,0,1,0,1,16
1,1,1,1,0,1,1,1,0,16
1,1,1,0,1,1,1,0,1,16
#ON -> ON_COUNT_7 where there's 7 neighbors
1,1,1,1,1,1,1,1,0,17
1,1,1,1,1,1,1,0,1,17
#ON -> ON_COUNT_8 where there's 8 neighbors
1,1,1,1,1,1,1,1,1,18
This reduces the number of transitions from 511 to 101. It is equivalent to one transition for each entry in the isotropic neighbourhood table. For the second stage you might be able to do something similar by generating a set of transitions with all permutations of the neighbour values for each of these neighbourhoods, rather than for all permutations.

P.S. I fixed up the two comment lines for three neighbours - one said "1 neighbors" and the other was missing.

Edit: Another potentially interesting rule: B6,7,9,10_S4,5,6,7_D2. This one is a (little) bit more like the Bugs rule from the Larger than Life rulespace.
The latest version of the 5S Project contains over 226,000 spaceships. There is also a GitHub mirror of the collection. Tabulated pages up to period 160 (out of date) are available on the LifeWiki.

pi_guy314
Posts: 88
Joined: July 21st, 2014, 9:45 pm

Re: C# Extended Neighborhood Emulator Script

Post by pi_guy314 » June 8th, 2017, 2:24 pm

Rather than trying to detect if a transition is a rotation / reflection of a previous transition, it might be possible to modify PermuteBits() to only return permutations which aren't rotations / reflections of each other.
Another idea might be to pregenerate all the transitions for each rule conditions instead. It should be the fastest way to generate a rule table.
Actually, the required set of transitions for the template can be generated with isotropic-rule-gen.py by generating the rule for B12345678/S012345678 and then modifying the result states as required. Here's the result of this process:
I was thinking about reducing the numbers of transitions, but I wasn't sure how to. Thank you.

pi_guy314
Posts: 88
Joined: July 21st, 2014, 9:45 pm

Re: C# Extended Neighborhood Emulator Script

Post by pi_guy314 » June 25th, 2017, 6:20 pm

Updated the Script to 0.2.0. Sorry that it took so long. The internet was down for about a week and we had to switch ISPs.

The full change-log is in the repository. The biggest change is that the script is extremely fast and the rule tables are much smaller. wildmyron's rule went from 1,456KB to 200KB. Golly can also run the rule-table a lot quicker.

Post Reply