Tutorials/Rules: Difference between revisions
No edit summary |
Apple Bottom (talk | contribs) Fmt |
||
| Line 2: | Line 2: | ||
== The Rule Table == | == The Rule Table == | ||
To create a new rule, you first need to know how to create RuleTables, which are the transitions that occur every generation, AKA Rules. For this tutorial, we are going to recreate Life but with the name "Tutorial". To start, open your favorite text editor and type: | To create a new rule, you first need to know how to create RuleTables, which are the transitions that occur every generation, AKA Rules. For this tutorial, we are going to recreate Life but with the name "Tutorial". To start, open your favorite text editor and type: | ||
<code> | <code> | ||
@RULE RuleName | @RULE RuleName | ||
</code> | </code> | ||
Where RuleName is the name of your rule, let's call this rule ''Tutorial'', for tutorial purposes. Next, add the ''table'', this is your actual transitions for the rule. Enter this before getting to the actual transitions. | |||
Where RuleName is the name of your rule, let's call this rule ''Tutorial'', for tutorial purposes. Next, add the ''table'', this is your actual transitions for the rule. Enter this before getting to the actual transitions. | |||
<code> | <code> | ||
@TABLE | @TABLE | ||
| Line 13: | Line 16: | ||
symmetries:permute | symmetries:permute | ||
</code> | </code> | ||
*'''@TABLE''': This tells Golly that the table starts here. | *'''@TABLE''': This tells Golly that the table starts here. | ||
*'''n_states''': This is how many states your rule has, '''INCLUDING''' state 0, the dead state/background, so 2 states will have live and dead states and 1 state will only have the background. | *'''n_states''': This is how many states your rule has, '''INCLUDING''' state 0, the dead state/background, so 2 states will have live and dead states and 1 state will only have the background. | ||
*'''neighborhood''': This is the neighborhood the rule uses, can be Moore, Hexagonal, vonNeumann, or oneDimensional, for the full list see the [https://github.com/GollyGang/ruletablerepository/wiki/RoadMap RoadMap] | *'''neighborhood''': This is the neighborhood the rule uses, can be Moore, Hexagonal, vonNeumann, or oneDimensional, for the full list see the [https://github.com/GollyGang/ruletablerepository/wiki/RoadMap RoadMap] | ||
*'''symmetries''': This is the arrangements accepted for each transition, none will make it so for example, if you want birth at 4 neighbors, you will have to write out every single arrangement of 4 neighbors. Permute makes it easy, we will come back to that later. | *'''symmetries''': This is the arrangements accepted for each transition, none will make it so for example, if you want birth at 4 neighbors, you will have to write out every single arrangement of 4 neighbors. Permute makes it easy, we will come back to that later. | ||
Now, transition time! Here, we will make Life, B3/S23. To make a transition, type a string as so:<br/> | Now, transition time! Here, we will make Life, B3/S23. To make a transition, type a string as so:<br/> | ||
<code> | <code> | ||
Starting State, N Neighbor State, NE Neighbor State, E Neighbor State, SE Neighbor State, S Neighbor State, SW Neighbor State, W Neighbor State, NW Neighbor State, New State</code> | Starting State, N Neighbor State, NE Neighbor State, E Neighbor State, SE Neighbor State, S Neighbor State, SW Neighbor State, W Neighbor State, NW Neighbor State, New State</code> | ||
So, for Life, B3 to be exact: | |||
So, for Life, B3 to be exact: | |||
<code> | <code> | ||
0,1,1,1,0,0,0,0,0,1 | 0,1,1,1,0,0,0,0,0,1 | ||
</code> | </code> | ||
Which means that if a state 0 cell has 3 neighbors, it will become state 1. This is where permute comes in, if we didn't have permute, say '''none''', it would only make the cell live if it is ''exactly'' the same as we put it, live on the North, North East, and East '''only''', but '''permute''' makes it so all B3 states are filled. Now we make transitions for death. We don't do it for survival because survival means no transition happens to the cell. | |||
Which means that if a state 0 cell has 3 neighbors, it will become state 1. This is where permute comes in, if we didn't have permute, say '''none''', it would only make the cell live if it is ''exactly'' the same as we put it, live on the North, North East, and East '''only''', but '''permute''' makes it so all B3 states are filled. Now we make transitions for death. We don't do it for survival because survival means no transition happens to the cell. | |||
<code> | <code> | ||
1,0,0,0,0,0,0,0,0,0<br/> | 1,0,0,0,0,0,0,0,0,0<br/> | ||
| Line 33: | Line 43: | ||
1,1,1,1,1,1,1,1,0,0<br/> | 1,1,1,1,1,1,1,1,0,0<br/> | ||
1,1,1,1,1,1,1,1,1,0</code> | 1,1,1,1,1,1,1,1,1,0</code> | ||
It should now look like this: | |||
It should now look like this: | |||
<code> | <code> | ||
@RULE Tutorial<br/> | @RULE Tutorial<br/> | ||
| Line 49: | Line 61: | ||
1,1,1,1,1,1,1,1,0,0<br/> | 1,1,1,1,1,1,1,1,0,0<br/> | ||
1,1,1,1,1,1,1,1,1,0</code> | 1,1,1,1,1,1,1,1,1,0</code> | ||
And now, select all of it and paste it into Golly, and it's life in all it's glory! | And now, select all of it and paste it into Golly, and it's life in all it's glory! | ||
| Line 55: | Line 68: | ||
*[http://www.conwaylife.com/forums/viewtopic.php?f=11&t=2608 Finality4] | *[http://www.conwaylife.com/forums/viewtopic.php?f=11&t=2608 Finality4] | ||
*[http://www.conwaylife.com/forums/viewtopic.php?f=11&t=803 Unrecognised CA Thread (You can find ''a lot'' here)] | *[http://www.conwaylife.com/forums/viewtopic.php?f=11&t=803 Unrecognised CA Thread (You can find ''a lot'' here)] | ||
[[Category:Tutorials]] | |||
Revision as of 11:49, 30 June 2017
Oh so you want to make your own cellular automata? Here's the place to learn how!
The Rule Table
To create a new rule, you first need to know how to create RuleTables, which are the transitions that occur every generation, AKA Rules. For this tutorial, we are going to recreate Life but with the name "Tutorial". To start, open your favorite text editor and type:
@RULE RuleName
Where RuleName is the name of your rule, let's call this rule Tutorial, for tutorial purposes. Next, add the table, this is your actual transitions for the rule. Enter this before getting to the actual transitions.
@TABLE
n_states:2
neighborhood:Moore
symmetries:permute
- @TABLE: This tells Golly that the table starts here.
- n_states: This is how many states your rule has, INCLUDING state 0, the dead state/background, so 2 states will have live and dead states and 1 state will only have the background.
- neighborhood: This is the neighborhood the rule uses, can be Moore, Hexagonal, vonNeumann, or oneDimensional, for the full list see the RoadMap
- symmetries: This is the arrangements accepted for each transition, none will make it so for example, if you want birth at 4 neighbors, you will have to write out every single arrangement of 4 neighbors. Permute makes it easy, we will come back to that later.
Now, transition time! Here, we will make Life, B3/S23. To make a transition, type a string as so:
Starting State, N Neighbor State, NE Neighbor State, E Neighbor State, SE Neighbor State, S Neighbor State, SW Neighbor State, W Neighbor State, NW Neighbor State, New State
So, for Life, B3 to be exact:
0,1,1,1,0,0,0,0,0,1
Which means that if a state 0 cell has 3 neighbors, it will become state 1. This is where permute comes in, if we didn't have permute, say none, it would only make the cell live if it is exactly the same as we put it, live on the North, North East, and East only, but permute makes it so all B3 states are filled. Now we make transitions for death. We don't do it for survival because survival means no transition happens to the cell.
1,0,0,0,0,0,0,0,0,0
1,1,0,0,0,0,0,0,0,0
1,1,1,1,1,0,0,0,0,0
1,1,1,1,1,1,0,0,0,0
1,1,1,1,1,1,1,0,0,0
1,1,1,1,1,1,1,1,0,0
1,1,1,1,1,1,1,1,1,0
It should now look like this:
@RULE Tutorial
@TABLE
n_states:2
neighborhood:Moore
symmetries:permute
0,1,1,1,0,0,0,0,0,1
1,0,0,0,0,0,0,0,0,0
1,1,0,0,0,0,0,0,0,0
1,1,1,1,1,0,0,0,0,0
1,1,1,1,1,1,0,0,0,0
1,1,1,1,1,1,1,0,0,0
1,1,1,1,1,1,1,1,0,0
1,1,1,1,1,1,1,1,1,0
And now, select all of it and paste it into Golly, and it's life in all it's glory!