shipunov (version 1.5)

Life: Game of Life

Description

Conway's Game of Life

Usage

Life(n.rows=40, n.cols=40, n.cycles=100, sleep.time=0.12,
 cols=c("#f0f0f0", "#2f81c1"), random=TRUE, rnd.threshold=0.3)

Arguments

n.rows

Number of rows

n.cols

Number of columns

n.cycles

Number of cycles

sleep.time

Time for pause after each cycle

cols

Main colors

random

If FALSE, runs in the interactive mode

rnd.threshold

0 empty board; 1 all squares are filled

Details

In the interactive mode (random=FALSE), left click to define or remove cells, then click on red square in the bottom left corner to start cycles. Click positions are rounded so they are not always precise.

To stop cycles, use Ctrl-C (Linux, macOS) or Esc (Windows) in the main R window.

The code was inspired by the Github gist (which is not available anymore) attributed to Vadim Vinichenko.

Examples

Run this code
# NOT RUN {
Life(n.cols=10, n.rows=10, n.cycles=10, sleep.time=0.3)
# }

Run the code above in your browser using DataCamp Workspace