# Is there an implemented way to draw Wolfram's elementary cellular automata?

I am wondering if there is an easy way to draw Wolfram's elementary cellular automaton (and some steps of its evolution) in LaTeX, for example, rule 30 as can be seen here:

http://mathworld.wolfram.com/CellularAutomaton.html

Of course one could try to draw it with TikZ but that would be rather complicated.

How can I draw the rule itself, i.e.

• In answer to your now deleted question, I recommend: 1) change the \setlength\boxsize{} argument to something smaller than 1ex; 2) to eliminate the box borders, set \fboxrule to 0pt; and 3) Inside of \boxart, change the \parskip setting to 0pt, if you have set \fboxrule to 0pt. – Steven B. Segletes Jul 20 '16 at 11:13
• Ok, I managed to draw the evolution itself. But how can I draw the vizualisation of the rule? – mathfemi Jul 20 '16 at 11:28

A possible solution with TikZ matrices

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix, positioning}

\begin{document}
\begin{tikzpicture}[b/.style={draw, minimum size=3mm,
fill=black},w/.style={draw, minimum size=3mm},
m/.style={matrix of nodes, column sep=1pt, row sep=1pt, draw, label=below:#1}, node distance=1pt]

\matrix (A) [m=0]{
|[b]|&|[b]|&|[b]|\\
&|[w]|\\
};
\matrix (B) [m=0, right=of A]{
|[b]|&|[b]|&|[w]|\\
&|[w]|\\
};
\matrix (C) [m=0, right=of B]{
|[b]|&|[w]|&|[b]|\\
&|[w]|\\
};
\matrix (D) [m=1, right=of C]{
|[b]|&|[w]|&|[w]|\\
&|[b]|\\
};
\matrix (E) [m=1, right=of D]{
|[w]|&|[b]|&|[b]|\\
&|[b]|\\
};
\matrix (F) [m=1, right=of E]{
|[w]|&|[b]|&|[w]|\\
&|[b]|\\
};
\matrix (G) [m=1, right=of F]{
|[w]|&|[w]|&|[b]|\\
&|[b]|\\
};
\matrix (H) [m=0, right=of G]{
|[w]|&|[w]|&|[w]|\\
&|[w]|\\
};

\end{tikzpicture}
\end{document}


An alternative solution:

\usepackage{amsmath}

$\LARGE \substack{\blacksquare \blacksquare \blacksquare \\ \square} \enspace \substack{\blacksquare \blacksquare \square \\ \square} \enspace \substack{\blacksquare \square \blacksquare \\ \square} \enspace \substack{\blacksquare \square \square \\ \blacksquare} \enspace \substack{\square \blacksquare \blacksquare \\ \blacksquare} \enspace \substack{\square \blacksquare \square \\ \blacksquare} \enspace \substack{\square \square \blacksquare \\ \blacksquare} \enspace \substack{\square \square \square \\ \square}$