Message Boards Message Boards

3
|
8357 Views
|
2 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Cellular Automata with 2D matrix initialization

Here's a rather fun snippet of code from my increasingly large notebook of interesting CA programs:

init=
{{1,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1},
{0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0},
{0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0},
{0,0,1,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1},
{0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0},
{0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0},
{0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0},
{1,1,1,0,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1}};

tostep[r_,s_,init_]:=Table[CellularAutomaton[r,i,{{s}}][[1]],{i,init}]
<!-- this is to separate the two code blocks. it's a useful trick! -->
ArrayPlot[init]

the word JESSE in an ArrayPlot

ArrayPlot[tostep[30, 20,init]]

a seemingly random ArrayPlot of the same dimensions as the first, but processed with the tostep function

Manipulate[
 ArrayPlot[tostep[r, s,init]], {{r, 30}, 1, 255, 1}, {{s, 20}, 0, 200, 1}]

a Manipulate of the CA rule and step set at 83 and 20 respectively. The output bears some resemblance to the input JESSE matrix.

It's interesting to see what rule and step combinations result in a resemblance to the original matrix.

POSTED BY: Jesse Friedman
2 Replies

enter image description here

POSTED BY: Simon Cadrin

enter image description here

POSTED BY: Simon Cadrin
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract