This function paints a turmite. A turmite is a Turing machine which has an orientation in addition to a current state and a "tape" that consists of a two-dimensional grid of cells.
canvas_turmite(
colors,
background = "#fafafa",
p = 0,
iterations = 1000000,
resolution = 500,
noise = FALSE
)
a character specifying the color used for the artwork. The number of colors determines the number of turmites.
a character specifying the color used for the background.
a value specifying the probability of a state switch within the turmite.
a positive integer specifying the number of iterations of the algorithm.
resolution of the artwork in pixels per row/column. Increasing the resolution increases the quality of the artwork but also increases the computation time exponentially.
logical. Whether to add k-nn noise to the artwork. Note that adding noise increases computation time significantly in large dimensions.
A ggplot
object containing the artwork.
The turmite algorithm consists of the following steps: 1) turn on the spot (left, right, up, down) 2) change the color of the square 3) move forward one square.
colorPalette
# \donttest{
set.seed(1)
# Simple example
canvas_turmite(colors = colorPalette("dark2"))
# }