ebcube wrote:Will you release the RuleTree source code?
This code relies on being able to simply derive the rule tree for the next higher number of states which I can only presume will only work for Generations-like states. To generate all the rule trees for _2 through _40 while you blink, enter something like:
- perl makeWMPVNruleTrees.pl 45678bc/459a/40
Code: Select all
#!/usr/bin/perl
# Create WMPVN-s_b_n.trees for specified s/b strings and 2 <= n <= c states
# by Tony Smith, Meme Media, Melbourne, Australia, December 2010
# extends Golly/Rules/TreeGenerators/RuleTreeGen.pl
use strict;
my ( @s, @b, $c, $part, %world, $nodeseq, @r, @params );
my $error = 'ok';
my $params = shift;
if ( @_ ) { $error = 'too many parameters' }
else {
my ( $s, $b, $max, @more ) = split /\//, $params;
if ( @more ) { $error = 'too many parts' }
elsif ( $max !~ /^[1-9]\d*$/ ) { $error = 'max states is not a positive integer' }
elsif ( $max < 2 ) { $error = 'max states must be > 1' }
else {
$c = $max;
if ( $s !~ /^[\dabc]+$/i ) { $error = 'survive list must only contain 0-9 or a-c' }
else {
@s = foundin( $s );
if ( scalar @s < length $s ) { $error = 'duplicate entries in survive list' }
elsif ( $b !~ /^[\dabc]+$/i ) { $error = 'born list must only contain 0-9 or a-c' }
else {
@b = foundin( $b );
if ( scalar @b < length $b ) { $error = 'duplicate entries in born list' }
else { $part = "WMPVN-$s\_$b\_" }
} } } }
die $error if $error ne 'ok'; # should prompt for parameter input rather than die
my $numNeighbors = 8;
my $numParams = $numNeighbors + 1;
my ( @lists, $numStates );
foreach $numStates ( 2 .. $c ) {
if ( $numStates == 2 ) { ruleTreeGen( 2 ) }
elsif ( $numStates == 3 ) {
my @r = ruleTreeGen( 3 );
foreach ( @r ) {
my @list = split / /;
push @lists, \@list;
}
}
else {
open ( NEW, '>', "$part$numStates.tree" ) || die "Cannot open file for output!";
print NEW "num_states=$numStates\n";
print NEW "num_neighbors=$numNeighbors\n";
print NEW "num_nodes=", scalar @r, "\n";
my @new = ();
foreach my $list ( @lists ) { # bump rule tree to next higher $numStates
my @list = @$list;
if ( $list[0] == 1 ) { # state values
splice( @list, -1, 0, $list[2] ? $numStates - 1 : 0 );
}
else { # node numbers
push( @list, $list[-1] );
}
my $new = join( ' ', @list);
print NEW "$new\n";
push @new, \@list;
}
close NEW;
@lists = @new;
}
}
sub ruleTreeGen {
$numStates = shift;
%world = ();
$nodeseq = 0;
@r = ();
@params = (0) x $numParams;
recur($numParams);
open ( NEW, '>', "$part$numStates.tree" ) || die "Cannot open file for output!";
print NEW "num_states=$numStates\n";
print NEW "num_neighbors=$numNeighbors\n";
print NEW "num_nodes=", scalar @r, "\n";
print NEW "$_\n" for @r;
close NEW;
return @r;
}
sub f { # Weighted Moore Plus Von Neumann
my ($nw, $ne, $sw, $se, $n, $w, $e, $s, $c) = @_;
return ($c + 1) % $numStates if $c > 1; # as in Generations
my $out = ($nw==1) + ($ne==1) + ($sw==1) + ($se==1);
my $in = ($n==1) + ($w==1) + ($e==1) + ($s==1);
my $sum = 2 * $in + $out;
return 1 if $c and $s[$sum]; # survive
return 1 if not $c and $b[$sum]; # born
return $c ? 2 : 0 if $numStates > 2; # commence dying if not dead
return 0; # die or stay dead
}
sub recur {
my $at = shift;
return f(@params) if $at == 0;
my $n = $at;
for (my $i=0; $i<$numStates; $i++) {
$params[$numParams-$at] = $i;
$n .= " " . recur($at-1);
}
return $world{$n} if defined($world{$n});
$world{$n} = $nodeseq;
push @r, $n;
return $nodeseq++;
}
sub foundin {
my $code = shift;
my @list = ( 0 ) x 13;
my $allow = '0123456789abc';
my $state = 0;
my %decode;
while ( $allow ) {
my $char = substr( $allow, 0, 1, '' );
$decode{ $char } = $state ++;
}
while ( $code ) {
my $char = substr( $code, 0, 1, '' );
@list[ $decode { $char } ] = 1;
}
return @list;
}
ebcube wrote:(Is it similar to MCell's Weighted Life symmetric rules?
Assuming Mirek's HI code is interpreted as in Generations, mine is a narrow subset of Weighted Life, with a specific neighbourhood chosen so as not to bias a direction:
Code: Select all
x = 129, y = 29, rule = 345/3/4
9C.9A.9C21.9A.9A.9A21.9A.9A.9A$C9.9A9.C21.9A.9A.9A21.4AC4A.3A3C3A.4AC
4A$C9.9A9.C21.9A.9A.9A21.3A2C4A.2AC3AC2A.3A2C4A$C9.9A9.C21.9A.9A.9A
21.4AC4A.6AC2A.4AC4A$C9.9A9.C21.9A.9A.9A21.4AC4A.5AC3A.4AC4A$C9.9A9.C
21.9A.9A.9A21.4AC4A.4AC4A.4AC4A$C9.9A9.C21.9A.9A.9A21.4AC4A.3AC5A.4AC
4A$C9.9A9.C21.9A.9A.9A21.3A3C3A.2A5C2A.3A3C3A$C9.9A9.C21.9A.9A.9A21.
9A.9A.9A2$9A.9B.9A21.9A.9B.9A21.9A.9B.9A$9A.9B.9A21.9A.9B.9A21.3A3C3A
.9B.3A3C3A$9A.9B.9A21.9A.9B.9A21.2AC3AC2A.9B.2AC3AC2A$9A.9B.9A21.9A.
9B.9A21.6AC2A.9B.6AC2A$9A.9B.9A21.9A.9B.9A21.5AC3A.9B.5AC3A$9A.9B.9A
21.9A.9B.9A21.4AC4A.9B.4AC4A$9A.9B.9A21.9A.9B.9A21.3AC5A.9B.3AC5A$9A.
9B.9A21.9A.9B.9A21.2A5C2A.9B.2A5C2A$9A.9B.9A21.9A.9B.9A21.9A.9B.9A2$C
9.9A9.C21.9A.9A.9A21.9A.9A.9A$C9.9A9.C21.9A.9A.9A21.4AC4A.3A3C3A.4AC
4A$C9.9A9.C21.9A.9A.9A21.3A2C4A.2AC3AC2A.3A2C4A$C9.9A9.C21.9A.9A.9A
21.4AC4A.6AC2A.4AC4A$C9.9A9.C21.9A.9A.9A21.4AC4A.5AC3A.4AC4A$C9.9A9.C
21.9A.9A.9A21.4AC4A.4AC4A.4AC4A$C9.9A9.C21.9A.9A.9A21.4AC4A.3AC5A.4AC
4A$C9.9A9.C21.9A.9A.9A21.3A3C3A.2A5C2A.3A3C3A$9C.9A.9C21.9A.9A.9A21.
9A.9A.9A!
ebcube wrote:I've always wanted to do a script to convert MCell weighted life rulestrings to Golly's RuleTree format, it should be fairly trivial
I agree but am having too much fun to think about tackling it myself.
ebcube wrote:The trail engine your puffer is based on (...)
In practice, many are born with a double blocked trail so continuing to lengthen while gaining "tagalongs" from orthogonal and diagonal ships until some tagalong detabilises the double block, after which they eventually settle into either a puffer or something more like the minimal spaceship you posted. (The c taglongs are somewhat less extravagant than in StarWars but more varied than the 2/3c tagalongs found in 345/3/n rules.)
ebcube wrote:The three well-known c/2 spaceships that appear in many generation rules, such as 3458/37/4.
Rules which produce those spaceships and serrated track have become my comfort zone as I've spent the last two years becoming way too familiar with their broad interaction dynamics. With that in mind, I recently tabulated the corner of the universe of rules where I plan to keep my attention:
Code: Select all
COMFORT FEATURES,Generations,wM+VN
Count range,0-8,0-12(c)
Survive,345(8?),45678(b?c?)
Born,3(6?7?8?),45(9?a?b?c?)
1/2 forward movement,born 3,born 45
1/2 toggling side cells,born 3,born 4
asym ship central cell death,not survive 6,not survive 9
sym ship central cell death,not survive 7,not survive a
tail/edge clean up,not survive 12,not survive (1?)23
track without gap stability,survive 35,survive 48
track with gap stability,survive 34,survive 46
gapless double track stability,survive 345,survive 468
block stability,survive 3,survive 5
blocked track stability,survive 5,survive 8
gap stability,not born 4,not born 6(7?8?)
track toothed edge stability,not born 5,not born 8
ebcube wrote:Two beautiful, simple oscillators (I like how most patterns seem to stop because of the death states and then suddenly come back to life)
You might also like:
Code: Select all
x = 67, y = 62, rule = WMPVN-45678bc_459a_22
3.2A$.6A$.A4.A$2A4.2A$.A4.A$.6A$3.2A7$16.2A$14.6A$14.A4GA$13.2AG2JG2A
$14.A4GA$14.6A$16.2A9$28.2A$26.6A$26.A4CA$25.2AC2FC2A$26.A4CA$26.6A$
28.2A4$61.POML$60.RQNKJ$58.UT2S2TKL$59.S2R.TMN$62.STPO$41.2A14.TU3.UR
Q$40.S2AS13.T$39.UT2AT14.SR$42.U16.R$60.RQPFG$58.U.USQEHF$38.UT18.KJI
LQCBAE$39.T18.LMHMNDHA$40.TSRHI14.KGFELI2A$41.USGJH14.J2A2IA$38.MLKNS
EDCG13.2AF3A$38.NOJOPFJBA14.ACA$39.MIHGNK2A14.3A$40.L2A2KA15.3A$40.2A
H3A$41.AE3A$40.2AC2A$40.5A$41.3A!
ebcube wrote:Now, on to the interesting part: the 13c/58 diagonal spaceship
Just a side note that this appears to work for state values 16 and above, though interaction byproducts vary wildly between states. Save for tests like this, I've only got to 19-22 in any detail as yet. Those four are all totally different, though within the eight point compass that the mix of c/2 and 13c/58 diagonal spaceships provides as common background. _19 is dominated by a 13c/107 diagonal puffer which fires 13c/58 diagonal spaceships forwards. _20 produces a rich variety of mostly orthogonal trails. _21 is dominated by a p78x64y330t settled puffer trail which also produces rakes of 13c/58 diagonal spaceships in such a way that the central pattern soon looks like a caged spaghetti monster.
ebcube wrote:I really like this rule. Probably because of the fancy neon colors, but still...
There is one more discovery, but it warrants a separate thread.