An R package for creating cellular automata.

library(cellularautomata)

Create the plot of a cellular automaton

You can generate a cellular automaton using the ca function, specifying the Wolfram rule. For example:

ca(18) |> plot()
ca(30) |> plot()
ca(45) |> plot()
ca(195) |> plot()
Rule 18
Rule 30
Rule 45
Rule 195

Animations

You can get an animation of a cellular automaton using plot(animate = TRUE):

ca(30, ncols = 20, steps = 30) |> plot(animate = TRUE)
Rule 30

Polar coordinates

By default the line is wrapped, meaning it is actually a circle, with the end connected to the beginning.

You can plot it using polar coordinates:

ca(193, steps = 50) |> plot(time_flow = "up", circle = TRUE)
Rule 193, polar coordinates

This also works for animations:

ca(193, ncols = 25, steps = 100) |> plot(circle = TRUE, animate = TRUE)
Rule 193, polar coordinates

Acknowledgements

Original function created by Nicola Procopio.