3
|
8409 Views
|
2 Replies
|
5 Total Likes
View groups...
Share

# Cellular Automata with 2D matrix initialization

Posted 9 years ago
 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}]  ArrayPlot[init]  ArrayPlot[tostep[30, 20,init]]  Manipulate[ ArrayPlot[tostep[r, s,init]], {{r, 30}, 1, 255, 1}, {{s, 20}, 0, 200, 1}]  It's interesting to see what rule and step combinations result in a resemblance to the original matrix.
2 Replies
Sort By:
Posted 9 years ago
Posted 9 years ago