
Aug 19, 2017, 02:29 PM
|
|
|
Member Since: Dec 2016
Location: nowhere
Posts: 28
|
|
Quote:
Originally Posted by bearguardian
Anyone familiar with some more cellular automata properties? I am collecting anything related to it:
-On(black) and off(white) cell state depends upon the state of the cell itself(black or white) and those around it(black or white).
Category:Patterns - LifeWiki
https://wiki2.org/en/Cellular_automaton
Patterns of some seashells, like the ones in Conus and Cymbiola genus, are generated by natural cellular automata. The pigment cells reside in a narrow band along the shell's lip. Each cell secretes pigments according to the activating and inhibiting activity of its neighbor pigment cells, obeying a natural version of a mathematical rule. The cell band leaves the colored pattern on the shell as it grows slowly. For example, the widespread species Conus textile bears a pattern resembling Wolfram's rule 30 cellular automaton.
Cellular automata perl code:
Code:
#!/usr/bin/perl -- -*- cperl -*-
my%t=('H'=>[99,6,0,3,4,0,1],'*'=>[5,3,1,2,1,2,11],'O'=>[7,9,0,4,8,3,4]
,'x'=>[12,3,0,1,9,2,4],'+'=>[17,3,0,1,9,2,4],);sub _{my($x,$y,$t)=@_;$
g[$x][$y]=l($t,$x,$y)}sub l{my($t,$x,$y,$a)=@_;+{v=>$t,i=>sub{++$a;my(
$n,$s,$o);my@t=@{$t{$t}};for$u(-1..1){for$z(-1..1){$n=$g[$x+$u][$y+$z]
;if($n->{v}eq$t){++$s}elsif($n->{v}){++$o}}}if($s<$t[2]or$s>$t[1]or$o>
$t[4]or$o+$s<$t[5]or$a>$t[0]){undef$g[$x][$y]}if(rand(10)<$t[6]or$s==$
t[3]){my($v,$w)=map{rand(42)%3-1}0..1;$v+=$x;$w+=$y;$g[$v][$w]=l($t,$v
,$w)if not$g[$v][$w];}}}}map{_($$_[0],$$_[1],"H")}([20,10],[20,9],[21,
10],[21,9]);_(40,10,'*');_(39,10,'*');map{my$q=$_;map{_($_,$q,'O')}(29
,30)}(18,19);_(30,3,"+")^_(29,3,"x");while($:){&c;for$y(1..22){for$x(1
..60){if($m=$g[$x][$y]){print$$m{v};$$m{i}->()}else{print" "}}print$/}
print$/;sleep 1}sub c{`clear`}#To support Win32 make that sub c{`cls`}
|
Idk what to do with this yet, but you're presentation of the script was fascinating!!! I definitely read over it and tried to find mathematical patterns within it, even without knowing any perl yet. I like stuff like this. It's like biological back doors you can observe and then use as a rule in programing.
|