How do I make a new rule?

For discussion of other cellular automata.
Post Reply
User avatar
Saka
Posts: 3626
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

How do I make a new rule?

Post by Saka »

I have looked at the format, but how/where do I put stuff like B32/S15?
jarring cyan
User avatar
Kiran
Posts: 283
Joined: March 4th, 2015, 6:48 pm

Re: How do I make a new rule?

Post by Kiran »

Click on the "Control" menu at the top of the Golly window (where file and edit are, above the population counter.)
Click on the bottom item (Set Rule...).
A window should pop up.
Here you can enter your new rule, select a known rule from a menu or click help for more known rules and information (the window can be returned to it's original size by clicking help again).
Kiran Linsuain
User avatar
Saka
Posts: 3626
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: How do I make a new rule?

Post by Saka »

Kiran wrote:Click on the "Control" menu at the top of the Golly window (where file and edit are, above the population counter.)
Click on the bottom item (Set Rule...).
A window should pop up.
Here you can enter your new rule, select a known rule from a menu or click help for more known rules and information (the window can be returned to it's original size by clicking help again).
in a .rule file
jarring cyan
User avatar
gmc_nxtman
Posts: 1158
Joined: May 26th, 2015, 7:20 pm

Re: How do I make a new rule?

Post by gmc_nxtman »

Visit https://code.google.com/p/ruletablerepo ... /TheFormat

and

https://code.google.com/p/ruletablerepo ... ki/RoadMap

EDIT: Before you do that, here are the basic instructions.

Make a new file called "x.rule" in the Specified golly > preferences > My rules directory. X means anything you want, so name it whatever you like. Open the file. In the file, write

@RULE x
@TABLE

Where x must match exactly what you named the file.

2 lines beneath @TABLE, write

n_states:x
neighborhood:x
symmetries:x

n_states specifies how many states are in the cellular automaton, neighborhood is what counts technically as the "neighbors" of a cell, (similar to how in conway's life using the moore neighborhood) the total possible neighborhoods are all at the second link I posted above. Not all of them are compatible with Golly, though.
Symmetries defines how (if at all) the transitions still apply when rotated/reflected/permutated. The total possible symmetries depends on the rule. After that, you will write the transitions (and/or) variables.

For this example, we'll use the vonNeumann neighborhood (the four cells directly next to one cell)

0,1,1,0,0,1

The first number is what state the cell starts off as, the last is what it turns into, and the numbers in between specify the transition.

It's sort of like

Code: Select all

        010
0 ->    110
        010
Where The left number is the first number, the number in the middle is the last number. The four numbers in the middle of the sequence are just the neighbors of the cell read left-to-right, top-to-bottom.

Variables are a way of compacting the rule table even more.

In this example, we'll use a 2-state automaton in which every live cell always dies.

var a={0,1}

Means that writing the letter a in the transition line will cause it to apply the transition when the specified neighbor is both 1 and 0.

You can't use the same variable multiple times on one line. You have to use

var a={0,1}
var b={a}
var c={a}

and so on, until however many neighbors the automaton has,
and list them in order like so.

1,a,b,c,d,0

where state 1 cells turn to state 0 cells no matter what.

Got it?

(sorry if this post is a bit long. I want to stop all the threads on how to write rule tables, and just put the instructions here)
Last edited by gmc_nxtman on August 11th, 2015, 11:16 am, edited 1 time in total.
User avatar
Andrew
Moderator
Posts: 1066
Joined: June 2nd, 2009, 2:08 am
Location: Melbourne, Australia
Contact:

Re: How do I make a new rule?

Post by Andrew »

gmc_nxtman wrote:Make a new file called "x.rule" in the Applications > Golly > Rules directory.
It's not a good idea to store your own files in Golly's supplied folders -- there's a good chance you'll lose them when you upgrade to a newer version. Your .rule files should be stored in a separate folder specified in Preferences > Control.

See Help > Hints and Tips for the recommended way to set up your Golly folder so that your own rules/scripts/patterns are in separate folders but still easily accessible from the left panel.
Use Glu or Glui to explore CA rules on non-periodic tilings: DominoLife and HatLife and SpectreLife
User avatar
Saka
Posts: 3626
Joined: June 19th, 2015, 8:50 pm
Location: Indonesia
Contact:

Re: How do I make a new rule?

Post by Saka »

Thanks, helped me a lot, but I still don't get the variable thing does it mean
a={1,2}
the neighbor can be 1 OR 2?
jarring cyan
User avatar
gmc_nxtman
Posts: 1158
Joined: May 26th, 2015, 7:20 pm

Re: How do I make a new rule?

Post by gmc_nxtman »

Yes. It means you can compact rule tables, by using one line for multiple transitions.

The following two tables are equivalent, however one uses variables:

0,1,0,0,0,0,0,0,0,1
0,2,0,0,0,0,0,0,0,1

var a={1,2}
0,a,0,0,0,0,0,0,0,1
Post Reply