canvas_turmite {aRtsy}R Documentation

Draw Turmites

Description

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.

Usage

canvas_turmite(
  colors,
  background = "#fafafa",
  p = 0,
  iterations = 1000000,
  resolution = 500,
  noise = FALSE
)

Arguments

colors

a character specifying the color used for the artwork. The number of colors determines the number of turmites.

background

a character specifying the color used for the background.

p

a value specifying the probability of a state switch within the turmite.

iterations

a positive integer specifying the number of iterations of the algorithm.

resolution

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.

noise

logical. Whether to add k-nn noise to the artwork. Note that adding noise increases computation time significantly in large dimensions.

Details

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.

Value

A ggplot object containing the artwork.

Author(s)

Koen Derks, koen-derks@hotmail.com

References

https://en.wikipedia.org/wiki/Turmite

See Also

colorPalette

Examples


set.seed(1)

# Simple example
canvas_turmite(colors = colorPalette("dark2"))



[Package aRtsy version 0.2.4 Index]