1

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

mathfemi
  • 143
  • http://tex.stackexchange.com/q/118377/1952, http://tex.stackexchange.com/q/145319/1952, http://tex.stackexchange.com/q/123719/1952 – Ignasi Jul 20 '16 at 10:20
  • Related, perhaps: http://tex.stackexchange.com/questions/157080/can-tikz-create-pixel-art-images and http://tex.stackexchange.com/questions/308936/what-is-the-best-way-to-create-this-kind-of-binary-matrix – Steven B. Segletes Jul 20 '16 at 10:20
  • 1
    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

2 Answers2

3

A possible solution with TikZ matrices

enter image description here

\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}
Ignasi
  • 136,588
0

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}
\]
user76284
  • 143