Learn R Programming

simecol (version 0.5-5)

conway: The Classical Coway's Game of Life

Description

simecol example: This model simulates a deterministic cellular automaton.

Usage

data(conway)

Arguments

Details

To see all details, please have a look into the implementation.

References

Gardner, Martin (1970) The Fantastic Combinations of John Conway's New Solitaire Game 'Life.' Scientific American, October 1970.

See Also

sim, parms, init, times.

Examples

Run this code
data(conway)
    plot(sim(conway))

    # more interesting start conditions
    m <- matrix(0, 40, 40)
    m[5:35,19:21] <-1
    init(conway) <- m
    plot(sim(conway), col=c("white", "green"), axes=FALSE)

    # change survival rules
    parms(conway) <- list(srv=c(3,4), gen=c(3,4))
    plot(sim(conway), col=c("white", "green"), axes=FALSE)
    init(conway) <- matrix(0, 10, 10)
    fixInit(conway) # enter some "1"
    sim(conway, animate=TRUE, delay=100)

Run the code above in your browser using DataLab