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:


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. enter image description here


A possible solution with TikZ matrices

enter image description here

\usetikzlibrary{matrix, positioning}

\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]{
\matrix (B) [m=0, right=of A]{
\matrix (C) [m=0, right=of B]{
\matrix (D) [m=1, right=of C]{
\matrix (E) [m=1, right=of D]{
\matrix (F) [m=1, right=of E]{
\matrix (G) [m=1, right=of F]{
\matrix (H) [m=0, right=of G]{


An alternative solution:


\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.