Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

For discussion of other cellular automata.
User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 4th, 2021, 7:37 pm

24 May, 2021 - Blog post with further details of MNCA published:

https://slackermanz.com/understanding-m ... -automata/

Showcase: Expanding on the basic algorithms behind 2D Totalistic Cellular Automata like the well-known "Conway's Game of Life", I present a series of techniques that individually or in conjunction, can increase the complexity and diversity of the resulting patterns generated in these models.
  • Multiple Neighborhoods
  • Result-Potential Discrimination & Selection
  • Cross-Layer Coupling
The most significant development in my algorithmic explorations has been the 'Multiple Neighborhood' technique. Multiple Neighborhood Cellular Automata (MNCA) allow for a vast increase in the complexity, diversity, and specificity of the structures and behaviors of these models.

Of particular note is the tenancy for MNCA models to form soliton-like structures that exhibit individualized, unit-like local identities. These often resemble ball-like particles or worm-like structures of incredible resilience that can interact with each other and their surroundings in a robust and non-destructive manner. Mobile, yet solid-looking wave-like expressions are also common, and appear to 'bounce' along their full contact length when they collide with other waves or structures, doing so with the appearance of elasticity or compressibility.

These structures and expressions seem to be mostly unique to MNCA, and can sometimes be reasonably described using the terminology of agent-based models. Furthermore, their interactions are capable of producing a number of diverse second-order complex interactions and structures.

This second-order emergent complexity can express itself in many ways. These can include structures resembling the way atoms bind and interact to form molecules, predator-prey interactions, or as functional second-order structures with behaviors that do not exist in the isolated units or in alternate configurations of those units.

Due to the increased demand on computation resources required to simulate MNCA, I migrated my work from CPU-based render engine to methods utilizing GPU acceleration for the generation of patterns.

The MNCA technique involves the definition and assessment of more than one unique and separate local group of neighbors for use in a single set of conditional transitions. The terms and layout of such a structure are as follows:

Code: Select all

"ReferenceValue" 	: Value of this pixel from the reference/previous frame
"NewValue"		: Final value that will be output to the next frame
"NeighborhoodAvg" 	: [Sum / Total] of values at the relative coordinates in the neighborhood
"TransitionCondition"	: Specifies a valid range of values for the assessed input
"UpdateFunction"	: The method used to change the final output value

Code: Select all

Single-neighborhood CA, such as Conway's Game of Life:
    Using 1 neighborhood with 3 transitions:
        Get ReferenceValue;
        Get NeighborhoodAvg[0];
        Set NewValue to ReferenceValue;

        If NeighborhoodAvg[0] satisfies TransitionCondition[0]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[0] satisfies TransitionCondition[1]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[0] satisfies TransitionCondition[2]:
            NewValue = UpdateFunction(NewValue);

        Return NewValue;

Code: Select all

Mutiple Neighborhoods CA (MNCA):
    Using 3 neighborhoods with 3, 5, and 2 transitions:
        Get ReferenceValue;
        Get NeighborhoodAvg[0];
        Get NeighborhoodAvg[1];
        Get NeighborhoodAvg[2];

        Set NewValue to ReferenceValue;

        If NeighborhoodAvg[0] satisfies TransitionCondition[0]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[0] satisfies TransitionCondition[1]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[0] satisfies TransitionCondition[2]:
            NewValue = UpdateFunction(NewValue);

        If NeighborhoodAvg[1] satisfies TransitionCondition[3]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[1] satisfies TransitionCondition[4]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[1] satisfies TransitionCondition[5]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[1] satisfies TransitionCondition[6]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[1] satisfies TransitionCondition[7]:
            NewValue = UpdateFunction(NewValue);

        If NeighborhoodAvg[2] satisfies TransitionCondition[8]:
            NewValue = UpdateFunction(NewValue);
        If NeighborhoodAvg[2] satisfies TransitionCondition[9]:
            NewValue = UpdateFunction(NewValue);

        Return NewValue;
I'm still working on analyzing, understanding and documenting the other methods mentioned, so I'll update this post or create a separate thread when I have that documentation ready.

Additional reading and alternate implementations:

Jason Rampe ( @Softology, https://softologyblog.wordpress.com ) has written multiple blog posts about my work at various stages of development, and has implemented thousands of provided MNCA and SMNCA patterns in his legendary application, Visions of Chaos. He has also documented a selection of patterns on his YouTube channel.
Last edited by Slackermanz on May 23rd, 2021, 10:55 am, edited 4 times in total.

User avatar
yujh
Posts: 3068
Joined: February 27th, 2020, 11:23 pm
Location: I'm not sure where I am, so please tell me if you know
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by yujh » May 4th, 2021, 7:44 pm

Still the same thing, Can I achieve this using ready? (though I don't know how to use that correctly)
Rule modifier

B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7

Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 4th, 2021, 7:51 pm

yujh wrote:
May 4th, 2021, 7:44 pm
Still the same thing, Can I achieve this using ready? (though I don't know how to use that correctly)
It should be entirely capable of replicating the MNCA/SMNCA patterns, although I haven't translated the shaders into a format compatible with ready at this point in time.

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 4th, 2021, 8:55 pm

Square Cell supports something similar. See:

https://www.conwaylife.com/forums/viewt ... 7859#p7835

Brian Prentice

User avatar
yujh
Posts: 3068
Joined: February 27th, 2020, 11:23 pm
Location: I'm not sure where I am, so please tell me if you know
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by yujh » May 4th, 2021, 9:06 pm

bprentice wrote:
May 4th, 2021, 8:55 pm
Square Cell supports something similar. See:

https://www.conwaylife.com/forums/viewt ... 7859#p7835

Brian Prentice
I think this one supports continuous CA while yours don’t.
stop advertising your applications although they are good! It’s really annoying
Rule modifier

B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7

Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 5th, 2021, 1:03 am

bprentice wrote:
May 4th, 2021, 8:55 pm
Square Cell supports something similar.
At a glance it does not seem like the methods you describe operate in a similar manner. Do the results resemble the ones I have linked in the initial post, specifically with regard to robust agent-like interactive units?

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 5th, 2021, 9:14 am

yujh wrote:
May 4th, 2021, 9:06 pm
I think this one supports continuous CA while yours don’t.
Almost all the posts in this forum refer to cellular automata that evolve using discrete steps. The post that introduced this thread does not mention that the "Multiple Neighborhood'" technique does not use such steps.
Slackermanz wrote:
May 5th, 2021, 1:03 am
At a glance it does not seem like the methods you describe operate in a similar manner. Do the results resemble the ones I have linked in the initial post, specifically with regard to robust agent-like interactive units?
If you want to know what the cyclic rule family that is implemented in Square Cell does, simply try it.

Brian Prentice

User avatar
yujh
Posts: 3068
Joined: February 27th, 2020, 11:23 pm
Location: I'm not sure where I am, so please tell me if you know
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by yujh » May 5th, 2021, 9:52 am

bprentice wrote:
May 5th, 2021, 9:14 am
yujh wrote:
May 4th, 2021, 9:06 pm
I think this one supports continuous CA while yours don’t.
Almost all the posts in this forum refer to cellular automata that evolve using discrete steps. The post that introduced this thread does not mention that the "Multiple Neighborhood'" technique does not use such steps.
Slackermanz wrote:
May 5th, 2021, 1:03 am
At a glance it does not seem like the methods you describe operate in a similar manner. Do the results resemble the ones I have linked in the initial post, specifically with regard to robust agent-like interactive units?
If you want to know what the cyclic rule family that is implemented in Square Cell does, simply try it.

Brian Prentice
Sorry for quoting all these, I will just tell you this is continuous ones like smoothlife (where grids are useless, I think).

Bprentice,

Please show me a smoothlife pattern with your that supports it.
Rule modifier

B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7

Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 5th, 2021, 5:49 pm

bprentice wrote:
May 5th, 2021, 9:14 am
Almost all the posts in this forum refer to cellular automata that evolve using discrete steps. The post that introduced this thread does not mention that the "Multiple Neighborhood'" technique does not use such steps.

If you want to know what the cyclic rule family that is implemented in Square Cell does, simply try it.
yujh wrote:
May 5th, 2021, 9:52 am
I will just tell you this is continuous ones like smoothlife (where grids are useless, I think).

Please show me a smoothlife pattern with your that supports it.
To both of you;

These techniques produce valid results in two-state 'discrete', as well as continuous-state (and continuous-time models), and examples of both state quantities have been provided in the initial post.
bprentice wrote:
May 4th, 2021, 8:55 pm
Square Cell supports something similar.
bprentice wrote:
May 5th, 2021, 9:14 am
If you want to know what the cyclic rule family that is implemented in Square Cell does, simply try it.
Brian, you made the assertion that your program performed something similar to MNCA, implying that it produces similar results using one or more technique resembling: Multiple Neighborhoods, Result-Potential Discrimination & Selection, Cross-Layer Coupling.

Telling me to "simply try it" instead of answering my question is honestly, rude. I took it on good faith that you weren't just here to advertise your program(s), and are actually participating in this thread to discuss the topic - MNCA.

Additionally, I would like to make it clear that I have no interest whatsoever in what the "cyclic rule family in Square Cell" does, unless it specifically relates to the topic in this thread. So far, I don't see indications that that is true.

Therefore, I'll give you another opportunity by asking again; does your program achieve similar results through similar techniques?

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 5th, 2021, 11:17 pm

Slackermanz wrote:
May 4th, 2021, 7:37 pm
The most significant development in my algorithmic explorations has been the 'Multiple Neighborhood' technique. Multiple Neighborhood Cellular Automata (MNCA) allow for a vast increase in the complexity, diversity, and specificity of the structures and behaviors of these models.
Most of the contributors to these forums use Golly and/or LifeViewer to demonstrate their ideas. Can you use either of these simulators to show the versatility of your 'Multiple Neighborhood' technique?
Slackermanz wrote:
May 5th, 2021, 5:49 pm
Brian, you made the assertion that your program performed something similar to MNCA, implying that it produces similar results using one or more technique resembling: Multiple Neighborhoods, Result-Potential Discrimination & Selection, Cross-Layer Coupling.
I made no such implication. I simply referenced a rule family supported by Square Cell called Cyclic which cycles through different neighborhoods while using a fixed rule table.

Brian Prentice

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 6th, 2021, 2:14 am

bprentice wrote:
May 5th, 2021, 11:17 pm
Most of the contributors to these forums use Golly and/or LifeViewer to demonstrate their ideas. Can you use either of these simulators to show the versatility of your 'Multiple Neighborhood' technique?
To my knowledge, MNCA and the other mentioned extensions have not been simulated using Golly or LifeViewer, and I am not familiar with the nuances of those implementations.

That said, any program capable of running CGoL should be fundamentally capable of running the algorithms that generate the showcased patterns without additional resources or engine development - a principal that I have maintained while developing these techniques. The only caveat would be performance - GPU acceleration is required for simulating larger resolutions in real-time.
bprentice wrote:
May 5th, 2021, 11:17 pm
I made no such implication. I simply referenced a rule family supported by Square Cell called Cyclic which cycles through different neighborhoods while using a fixed rule table.
So it's unrelated? Why mention it at all in this thread? :roll:

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 6th, 2021, 3:08 am

Slackermanz wrote:
May 6th, 2021, 2:14 am
So it's unrelated? Why mention it at all in this thread?
I mentioned it because it features Multiple Neighborhood Cellular Automata which is the title of this thread!

Brian Prentice

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 6th, 2021, 3:20 am

bprentice wrote:
May 6th, 2021, 3:08 am
I mentioned it because it features Multiple Neighborhood Cellular Automata which is the title of this thread!
In the link you posted, I was unable to identify references or encodings specific to multiple neighborhoods in the files. If they were present though, it appears that the alternate configurations are applied as a cyclic phase, rather than during the same frame and set of calculations.

I conclude that we are not talking about similar methods, techniques, or resulting patterns.

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 6th, 2021, 3:33 am

Slackermanz wrote:
May 6th, 2021, 3:20 am
I conclude that we are not talking about similar methods, techniques, or resulting patterns.
No, but we are both talking about Multiple Neighborhood Cellular Automata.

This ridiculous back and forth is ruining your thread. I suggest that you provide your readers with software that they can use to experiment with your ideas.

Brian Prentice
Last edited by bprentice on May 6th, 2021, 4:08 am, edited 1 time in total.

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 6th, 2021, 4:08 am

bprentice wrote:
May 6th, 2021, 3:33 am
No, but we are both talking about Multiple Neighborhood Cellular Automata.
If my understanding is correct, your implementation uses phased neighborhoods - what I would call "Phase-Elected Neighborhoods In CA" (PENICA), similar to how the Margolus neighborhood operates. I consider this to be entirely distinct from MNCA. Both methods involve more than one neighborhood, but only MNCA uses the multiple neighborhoods in the calculation of a single result value in every frame.

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 6th, 2021, 4:15 am

bprentice wrote:
May 6th, 2021, 3:33 am
I suggest that you provide your readers with software that they can use to experiment with your ideas.
There's a Shadertoy link in the initial post that contains editable code, and there are alternate implementations (separate from the provided VulkanAutomata source code) of these methods currently under development.

Feel free to use the pseudo-code provided (or I can supply implementation-specific code, if you'd like) to implement the methods in your engine or architecture of choice!

If the supplied information I have here is not sufficient to reproduce the method, please let me know so I can amend that.

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 6th, 2021, 5:32 am

Slackermanz wrote:
May 6th, 2021, 4:15 am
Feel free to use the pseudo-code provided.
I'm not sure how to code what you call transitions or transition condition. I usually use dialogs to display and modify rule parameters. Also, your pseudo code seems to select the last transition condition that is satisfied rather than the first.
Slackermanz wrote:
May 6th, 2021, 4:15 am
I can supply implementation-specific code, if you'd like to implement the methods in your engine or architecture of choice!
Can you run Java programs or even better can you modify and run Java programs? My simulator of choice would be Square Cell which is written in Java. Several dialogs that are used to display and modify parameters for various rule families would probably be useful and the pattern editor and pattern analyzer could be used as is.

As an alternative to Square Cell, Golly has rule tree generators in several languages in directory Golly/Rules/TreeGenerators. I use the Java one regularly. I would recommend that you start with this alternative.

Brian Prentice

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 6th, 2021, 6:54 am

bprentice wrote:
May 6th, 2021, 5:32 am
I'm not sure how to code what you call transitions or transition condition. I usually use dialogs to display and modify rule parameters. Also, your pseudo code seems to select the last transition condition that is satisfied rather than the first.
Good to know, I'll have a think on how to clarify that. Tell me if you think this makes sense, or if there's a better way to phrase it:

A "Transition Condition" would be one of the if statements. CGoL implementations often have 3:
  • IF NeighborhoodAvg[0] <= 1: ...
  • IF NeighborhoodAvg[0] == 2: ...
  • IF NeighborhoodAvg[0] >= 4: ...
The numbers in those Transition Conditions would be the "Conditional Transition Parameters"

The "UpdateFunction" inside the IF statements would be the value assignment, ie, NewValue = 1;

You are correct that the last transition condition would be dominant - they are assessed in an order-of-operations manner.

In a Two-State CA, the earlier assignment would be overwritten by the newer value, or in the case of Continuous-State CA, the value would change with respect to all increments/decrements, and the final result would be the ReferenceValue modified by the sum of all updates.
bprentice wrote:
May 6th, 2021, 5:32 am
Can you run Java programs or even better can you modify and run Java programs? My simulator of choice would be Square Cell which is written in Java. Several dialogs that are used to display and modify parameters for various rule families would probably be useful and the pattern editor and pattern analyzer could be used as is.

As an alternative to Square Cell, Golly has rule tree generators in several languages in directory Golly/Rules/TreeGenerators. I use the Java one regularly. I would recommend that you start with this alternative.
I actually used to use Java to simulate, but MNCA were too slow CPU-side, so I moved to GPU implementations. It is still possible to run these as plain Java, but it won't be fast. Converting my algorithms to other formats, architectures or languages isn't something I have time or effort to dedicate to, which is part of the reason I'm developing this documentation - so I can pass the necessary details on, allowing others to develop their own preferred implementations.

I understand it may be frustrating that these methods and algorithms aren't immediately available in everyone's preferred implementation, but I simply can't write all possible implementations myself. The techniques are logically simple enough (I'd hope!) to be implemented in a variety of contexts, and if I write this documentation properly, it should be easy for someone to reproduce the techniques and results.

If this is not the case, I need to know! All I really want is to be able to share these ideas in a coherent format so others can use them!

User avatar
yujh
Posts: 3068
Joined: February 27th, 2020, 11:23 pm
Location: I'm not sure where I am, so please tell me if you know
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by yujh » May 6th, 2021, 7:05 am

Wondering: I’m just thinking of someone that will try to compile everything on every system, then and only then will some applications will be easy to use. Also, is there a way to identify a rule’s properties out there(like how explosive it is) I think that will be quite useful.

Not: not hoping golly, the most popular application here, will support this. So @thegollygangs (doing stuff with ready recently, correct?), will translating these happen soon?
Rule modifier

B34kz5e7c8/S23-a4ityz5k
b2n3-q5y6cn7s23-k4c8
B3-kq6cn8/S2-i3-a4ciyz8
B3-kq4z5e7c8/S2-ci3-a4ciq5ek6eik7

Bored of Conway's Game of Life? Try Pedestrian Life -- not pedestrian at all!

bprentice
Posts: 920
Joined: September 10th, 2009, 6:20 pm
Location: Coos Bay, Oregon

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by bprentice » May 6th, 2021, 9:02 am

Slackermanz wrote:
May 6th, 2021, 2:14 am
That said, any program capable of running CGoL should be fundamentally capable of running the algorithms that generate the showcased patterns
Golly is the best CGoL simulator.
Slackermanz wrote:
May 6th, 2021, 6:54 am
I actually used to use Java to simulate
Good. Here is file RuleTreeGen.java

Code: Select all

import java.util.* ;
public class RuleTreeGen {
   /* Put your state count, neighbor count, and function here */
   final static int numStates = 2 ;
   final static int numNeighbors = 8 ;
   /* order for nine neighbors is nw, ne, sw, se, n, w, e, s, c */
   /* order for five neighbors is n, w, e, s, c */
   int f(int[] a) {
      int n = a[0] + a[1] + a[2] + a[3] + a[4] + a[5] + a[6] + a[7] ;
      if (n == 2 && a[8] != 0)
         return 1 ;
      if (n == 3)
         return 1 ;
      return 0 ;
   }
   final static int numParams = numNeighbors + 1 ;
   HashMap<String, Integer> world = new HashMap<String, Integer>() ;
   ArrayList<String> r = new ArrayList<String>() ;
   int[] params = new int[numParams] ;
   int nodeSeq = 0 ;
   int getNode(String n) {
      Integer found = world.get(n) ;
      if (found == null) {
         found = nodeSeq++ ;
         r.add(n) ;
         world.put(n, found) ;
      }
      return found ;
   }
   int recur(int at) {
      if (at == 0)
         return f(params) ;
      String n = "" + at ;
      for (int i=0; i<numStates; i++) {
         params[numParams-at] = i ;
         n += " " + recur(at-1) ;
      }
      return getNode(n) ;
   }
   void writeRuleTree() {
      System.out.println("num_states=" + numStates) ;
      System.out.println("num_neighbors=" + numNeighbors) ;
      System.out.println("num_nodes=" + r.size()) ;
      for (int i=0; i<r.size(); i++)
         System.out.println(r.get(i)) ;
   }
   public static void main(String[] args) throws Exception {
      RuleTreeGen rtg = new RuleTreeGen() ;
      rtg.recur(numParams) ;
      rtg.writeRuleTree() ;
   }
}
Just replace the Life definition in int f(int[] a) with an MNCA rule definition, compile and run. Then re-post RuleTreeGen.java with your rule definition together with the resulting rule tree file. This will do two things, first it will provide a means for your readers to experiment with your ideas and second it will allow people like me to implement an MNCA rule family without the need for pseudo code.

Brian Prentice

User avatar
dvgrn
Moderator
Posts: 10669
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by dvgrn » May 6th, 2021, 11:01 pm

bprentice wrote:
May 6th, 2021, 9:02 am
Here is file RuleTreeGen.java...

Just replace the Life definition in int f(int[] a) with an MNCA rule definition, compile and run.
Unless I'm missing something here, anything that generates a Golly rule tree is currently going to be limited to von Neumann or Moore range-1 neighborhoods (four or eight neighbors).

The specific neighborhoods defined in Slackermanz' MNCA rule definitions tend to be much larger patches than just the immediate neighbors of a cell. Here's a forum thread from last year with some sample definitions.

Here's the reduced format I was talking about in that linked post:

reduced-000000.frag:

Code: Select all

nhd0=-14,-3;-14,-2;-14,-1;-14,0;-14,1;-14,2;-14,3;-13,-6;-13,-5;-13,-4;-13,-3;-13,-2;-13,-1;-13,0;-13,1;-13,2;-13,3;-13,4;-13,5;-13,6;-12,-8;-12,-7;-12,-6;-12,-5;-12,-4;-12,-3;-12,-2;-12,-1;-12,0;-12,1;-12,2;-12,3;-12,4;-12,5;-12,6;-12,7;-12,8;-11,-9;-11,-8;-11,-7;-11,-6;-11,-5;-11,-4;-11,-3;-11,-2;-11,-1;-11,0;-11,1;-11,2;-11,3;-11,4;-11,5;-11,6;-11,7;-11,8;-11,9;-10,-10;-10,-9;-10,-8;-10,-7
nhd1=-10,-6;-10,-5;-10,5;-10,6;-10,7;-10,8;-10,9;-10,10;-9,-11;-9,-10;-9,-9;-9,-8;-9,-7;-9,7;-9,8;-9,9;-9,10;-9,11;-8,-12;-8,-11;-8,-10;-8,-9;-8,-8;-8,8;-8,9;-8,10;-8,11;-8,12;-7,-12;-7,-11;-7,-10;-7,-9;-7,-2;-7,-1;-7,0;-7,1;-7,2;-7,9;-7,10;-7,11;-7,12;-6,-13;-6,-12;-6,-11;-6,-10;-6,-4;-6,-3;-6,3;-6,4;-6,10;-6,11;-6,12;-6,13;-5,-13;-5,-12;-5,-11;-5,-10;-5,-5;-5,5;-5,10;-5,11
nhd2=-5,12;-5,13;-4,-13;-4,-12;-4,-11;-4,-6;-4,-1;-4,0;-4,1;-4,6;-4,11;-4,12;-4,13;-3,-14;-3,-13;-3,-12;-3,-11;-3,-6;-3,-2;-3,2;-3,6;-3,11;-3,12;-3,13;-3,14;-2,-14;-2,-13;-2,-12;-2,-11;-2,-7;-2,-3;-2,3;-2,7;-2,11;-2,12;-2,13;-2,14;-1,-14;-1,-13;-1,-12;-1,-11;-1,-7;-1,-4;-1,-1;-1,0;-1,1;-1,4;-1,7;-1,11;-1,12;-1,13;-1,14;0,-14;0,-13;0,-12;0,-11;0,-7;0,-4;0,-1;0,1;0,4
nhd3=0,7;0,11;0,12;0,13;0,14;1,-14;1,-13;1,-12;1,-11;1,-7;1,-4;1,-1;1,0;1,1;1,4;1,7;1,11;1,12;1,13;1,14;2,-14;2,-13;2,-12;2,-11;2,-7;2,-3;2,3;2,7;2,11;2,12;2,13;2,14;3,-14;3,-13;3,-12;3,-11;3,-6;3,-2;3,2;3,6;3,11;3,12;3,13;3,14;4,-13;4,-12;4,-11;4,-6;4,-1;4,0;4,1;4,6;4,11;4,12;4,13;5,-13;5,-12;5,-11;5,-10;5,-5;5,5
nhd4=5,10;5,11;5,12;5,13;6,-13;6,-12;6,-11;6,-10;6,-4;6,-3;6,3;6,4;6,10;6,11;6,12;6,13;7,-12;7,-11;7,-10;7,-9;7,-2;7,-1;7,0;7,1;7,2;7,9;7,10;7,11;7,12;8,-12;8,-11;8,-10;8,-9;8,-8;8,8;8,9;8,10;8,11;8,12;9,-11;9,-10;9,-9;9,-8;9,-7;9,7;9,8;9,9;9,10;9,11;10,-10;10,-9;10,-8;10,-7;10,-6;10,-5;10,5;10,6;10,7;10,8;10,9;10,10
nhd5=11,-9;11,-8;11,-7;11,-6;11,-5;11,-4;11,-3;11,-2;11,-1;11,0;11,1;11,2;11,3;11,4;11,5;11,6;11,7;11,8;11,9;12,-8;12,-7;12,-6;12,-5;12,-4;12,-3;12,-2;12,-1;12,0;12,1;12,2;12,3;12,4;12,5;12,6;12,7;12,8;13,-6;13,-5;13,-4;13,-3;13,-2;13,-1;13,0;13,1;13,2;13,3;13,4;13,5;13,6;14,-3;14,-2;14,-1;14,0;14,1;14,2;14,3
fin_0=nhd0+nhd1+nhd2+nhd3+nhd4+nhd5
if (fin_0>=0): out=0
if (fin_0>=126 and fin_0<=211): out=1
if (fin_0>=136 and fin_0<=161): out=1
if (fin_0>=156 and fin_0<=171): out=1
if (fin_0>=186 and fin_0<=211): out=1
if (fin_0>=36 and fin_0<=40): out=1
if (fin_0<=29): out=0
The original format was actual fragment shader code, I believe -- something I know the nearest thing to nothing at all about. The above example looked like this:

000000.frag:

Code: Select all

precision mediump float;
uniform sampler2D tex0_in;
uniform vec2 tex_size;
float cv(float fx,float fy){
    vec2 v=vec2(fx,fy);
    float o=texture2D(tex0_in,(gl_FragCoord.xy+v)/tex_size).r;
    if(o>0.0){
        return 1.0;
    }else{
        return 0.0;
    }
}
void main(){
    float outval=cv(0.0,0.0);
    float nhd0=cv(-14.0,-3.0)+cv(-14.0,-2.0)+cv(-14.0,-1.0)+cv(-14.0,0.0)+cv(-14.0,1.0)+cv(-14.0,2.0)+cv(-14.0,3.0)+cv(-13.0,-6.0)+cv(-13.0,-5.0)+cv(-13.0,-4.0)+cv(-13.0,-3.0)+cv(-13.0,-2.0)+cv(-13.0,-1.0)+cv(-13.0,0.0)+cv(-13.0,1.0)+cv(-13.0,2.0)+cv(-13.0,3.0)+cv(-13.0,4.0)+cv(-13.0,5.0)+cv(-13.0,6.0)+cv(-12.0,-8.0)+cv(-12.0,-7.0)+cv(-12.0,-6.0)+cv(-12.0,-5.0)+cv(-12.0,-4.0)+cv(-12.0,-3.0)+cv(-12.0,-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,-6.0)+cv(13.0,-5.0)+cv(13.0,-4.0)+cv(13.0,-3.0)+cv(13.0,-2.0)+cv(13.0,-1.0)+cv(13.0,0.0)+cv(13.0,1.0)+cv(13.0,2.0)+cv(13.0,3.0)+cv(13.0,4.0)+cv(13.0,5.0)+cv(13.0,6.0)+cv(14.0,-3.0)+cv(14.0,-2.0)+cv(14.0,-1.0)+cv(14.0,0.0)+cv(14.0,1.0)+cv(14.0,2.0)+cv(14.0,3.0);
    float fin_0=nhd0+nhd1+nhd2+nhd3+nhd4+nhd5;
    if(fin_0>=0.0){
        outval=0.0;
    }
    if(fin_0>=126.0&&fin_0<=211.0){
        outval=1.0;
    }
    if(fin_0>=136.0&&fin_0<=161.0){
        outval=1.0;
    }
    if(fin_0>=156.0&&fin_0<=171.0){
        outval=1.0;
    }
    if(fin_0>=186.0&&fin_0<=211.0){
        outval=1.0;
    }
    if(fin_0>=36.0&&fin_0<=40.0){
        outval=1.0;
    }
    if(fin_0<=29.0){
        outval=0.0;
    }
    gl_FragColor=vec4(outval,outval,outval,1.0);
}

User avatar
rowett
Moderator
Posts: 3814
Joined: January 31st, 2013, 2:34 am
Location: UK
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by rowett » May 7th, 2021, 2:12 am

It's the equivalent of defining n LtL custom neighbourhoods and then applying them in sequence to get the final cell state.

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 7th, 2021, 11:55 pm

rowett wrote:
May 7th, 2021, 2:12 am
It's the equivalent of defining n LtL custom neighbourhoods and then applying them in sequence to get the final cell state.
For the most simple implementation variants, this is correct.

User avatar
dvgrn
Moderator
Posts: 10669
Joined: May 17th, 2009, 11:00 pm
Location: Madison, WI
Contact:

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by dvgrn » May 8th, 2021, 7:23 am

Slackermanz wrote:
May 7th, 2021, 11:55 pm
rowett wrote:
May 7th, 2021, 2:12 am
It's the equivalent of defining n LtL custom neighbourhoods and then applying them in sequence to get the final cell state.
For the most simple implementation variants, this is correct.
Got any specific examples of interesting rules that are not a "simple implementation variant"? I'd be interested in coming up with a compact rule syntax that supports as wide a variety of these MNCA rules as possible.

Again, along with each sample rule spec, it would be great to have a starting configuration, number of ticks, and ending configuration -- something that can be used to test whether newly written implementation code is simulating the rule correctly.

User avatar
Slackermanz
Posts: 17
Joined: July 5th, 2020, 11:17 pm

Re: Multiple Neighborhood Cellular Automata (MNCA) - Slackermanz

Post by Slackermanz » May 8th, 2021, 6:11 pm

dvgrn wrote:
May 8th, 2021, 7:23 am
Got any specific examples of interesting rules that are not a "simple implementation variant"?
I think I misinterpreted, it was entirely correct for "MNCA" as an isolated method.

I don't think we should worry about the Result-Potential Discrimination & Selection or Cross-Layer Coupling for notation purposes, as I'm still struggling to understand the scope and mechanisms of Selection, in particular.

Post Reply