Variants of Generations Rules
Posted: January 6th, 2015, 8:56 pm
The thread introduced by "A for awesome" here:
viewtopic.php?f=11&t=1571
prompted me to publish this rule:
It was generated using this modified version of RuleTreeGen.java which is included with Golly:
The rule is defined in lines 6 thru 25. It has a diagonal replicator which can be used to construct numerous diagonal guns, ships and puffers. Some examples follow:
Brian Prentice
viewtopic.php?f=11&t=1571
prompted me to publish this rule:
Code: Select all
@RULE RuleTable095
@TREE
num_states=4
num_neighbors=8
num_nodes=41
1 0 2 3 0
1 2 2 3 1
2 0 1 0 0
2 1 0 1 1
3 2 3 2 2
1 0 2 2 0
2 0 5 0 0
3 3 6 3 3
4 4 7 4 4
2 5 0 5 5
3 6 9 6 6
4 7 10 7 7
5 8 11 8 8
1 1 2 1 0
2 0 13 0 0
3 9 14 9 9
4 10 15 10 10
5 11 16 11 11
6 12 17 12 12
2 13 0 13 13
3 14 19 14 14
4 15 20 15 15
5 16 21 16 16
6 17 22 17 17
7 18 23 18 18
2 0 0 0 0
3 19 25 19 19
4 20 26 20 20
5 21 27 21 21
6 22 28 22 22
7 23 29 23 23
8 24 30 24 24
1 0 2 0 0
2 0 32 0 0
3 25 33 25 25
4 26 34 26 26
5 27 35 27 27
6 28 36 28 28
7 29 37 29 29
8 30 38 30 30
9 31 39 31 31
@COLORS
0 0 0 0
1 255 0 0
2 0 255 0
3 0 0 255
Code: Select all
import java.util.*;
public class RuleTreeGen
{
/* Put your state count, neighbor count, and function here */
final static int numStates = 4;
final static int numNeighbors = 8;
final static int ruleTable[][] =
{
{0,2,0,0,0,1,0,0,0},
{2,2,2,2,2,2,2,2,2},
{3,3,3,2,3,1,3,3,0},
{0,1,0,0,0,0,0,0,0}
};
/* 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 count = 0;
for (int i = 0; i < 8; i++)
if (a[i] == 1)
count++;
return ruleTable[a[8]][count];
}
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("@RULE RuleTable095");
System.out.println("@TREE");
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));
System.out.println("@COLORS");
System.out.println("0 0 0 0");
System.out.println("1 255 0 0");
System.out.println("2 0 255 0");
System.out.println("3 0 0 255");
}
public static void main(String[] args) throws Exception
{
RuleTreeGen rtg = new RuleTreeGen();
rtg.recur(numParams);
rtg.writeRuleTree();
}
}
Code: Select all
x = 13, y = 21, rule = RuleTable095
4.ACB$3.AC3BCA$2.A.BC3BCA$.ACB.B.BCB.A$.CBCB3.B.BCA$.3B5.BCBC$10.3B
8$3B$CBCB5.3B$ACB.B3.BCBC$.A.BCB.B.BCA$2.AC3BCB.A$3.AC3BCA$6.BCA!
Code: Select all
x = 16, y = 30, rule = RuleTable095
2.C.C$.2A2CB$.2BC2B$.2A.2B6$10.BCA$10.2BCA$10.BCB.A$11.B.BCA$12.BCB
C$13.3B$12.3B$11.BCBC$10.B.BCA$9.BCB.A$9.2BCA$9.BCA6$2A.2B$2BC2B$2A
2CB$.C.C!
Code: Select all
x = 15, y = 21, rule = RuleTable095
2C.A2B$2C.A2B$2C.CAB$2.3C4$.BCA$.2BCA$.BCB.A$2.B.BCA$3.BCBC$4.3B3$9.
BCA$9.2BCA$9.BCB.A$10.B.BCA$11.BCBC$12.3B!
Code: Select all
x = 15, y = 22, rule = RuleTable095
.3B$2.B2C$2.2BC$.B.BC$2.2AB3$B3C$ABC.C$2ABC.C$4.C.C$4.B2C$4.ABC$4.2A
B2$8.B3C$8.ABC.C$8.2ABC.C$12.C.C$12.B2C$12.ABC$12.2AB!
Code: Select all
x = 15, y = 23, rule = RuleTable095
3C$.C$.2C$C.CA$3BC$B2.B4$.BCA$.2BCA$.BCB.A$2.B.BCA$3.BCBC$4.3B3$9.B
CA$9.2BCA$9.BCB.A$10.B.BCA$11.BCBC$12.3B!
Code: Select all
x = 25, y = 18, rule = RuleTable095
C.BCB$3CB$C2.B$2.2B.3C$4.2BC.C$4.BABC.C2.B3C$7.B2C2.ABC.C$7.ABC2.BA
.2C$7.2AB4.ABC$14.BAB4$20.B3C$20.ABC.C$20.BA.2C$22.ABC$22.BAB!
Code: Select all
x = 46, y = 38, rule = RuleTable095
3C2B$.C.B$2.CB4.3C$2.ACB4.C2.C2B$7.BA3C.B$7.3B.2CB$7.2BA2.ACB9$23.B
2.B$23.C2B$23.A2B$24.ACA4$29.C$26.BA2C$26.2BAC$26.3B$30.A5B$16.3CB6.
3B2.B.2B2C2B$16.2C2B6.2BA3B.BAC.B$16.CB.A6.BACABCB3.CB$16.BAB8.3C2B
3.3CB$33.2BA$32.2CBA4.3B$33.C.CB3.CBCB$34.C2B3.ACB.B$34.ACB4.A.BCB$
42.AC2B$43.ACB!
Code: Select all
x = 100, y = 36, rule = RuleTable095
2BA29.2BA29.2BA$CB.B28.CB.B28.CB.B$2CBA28.2CBA28.2CBA$3CB28.3CB28.3C
B4$7.BAB29.BAB29.BAB$7.CBA29.CBA29.CBA$7.2C.AB27.2C.AB27.2C.AB$7.C.
CBA27.C.CBA27.C.CBA$8.3CB28.3CB28.3CB4$47.BAB29.BAB$47.CBA29.CBA$47.
2C.AB27.2C.AB$47.C.CBA27.C.CBA$48.3CB28.3CB4$87.BAB$87.CBA$87.2C.AB
$87.C.CBA$88.3CB4$95.BAB$95.CBA$95.2C.AB$95.C.CBA$96.3CB!
Code: Select all
x = 110, y = 36, rule = RuleTable095
2.2BA34.2BA34.2BA$B2C2B32.B2C2B32.B2C2B$3BCB32.3BCB32.3BCB$B.BC33.B
.BC33.B.BC$.2AB34.2AB34.2AB2$8.2BA34.2BA34.2BA$6.B2CB.A31.B2CB.A31.
B2CB.A$6.ABC.2B31.ABC.2B31.ABC.2B$6.BA.2CB31.BA.2CB31.BA.2CB$8.ABC34.
ABC34.ABC$8.BAB34.BAB34.BAB3$53.2BA34.2BA$51.B2CB.A31.B2CB.A$51.ABC
.2B31.ABC.2B$51.BA.2CB31.BA.2CB$53.ABC34.ABC$53.BAB34.BAB3$98.2BA$96.
B2CB.A$96.ABC.2B$96.BA.2CB$98.ABC$98.BAB3$106.2BA$104.B2CB.A$104.AB
C.2B$104.BA.2CB$106.ABC$106.BAB!