morph
function. The gosperGliderGun
function provides an interesting starting configuration.gameOfLife(init, size, density = 0.3, steps = 200, viz = FALSE, tick = 0.5)gosperGliderGun()
density
.init
, but must be given if that parameter is missing. If both are specified and size
is larger than the dimensions of init
, then the latter will be padded with zerinit
is provided.TRUE
, the state of the system at each generation is plotted.viz
is FALSE
.steps
generations.The initial state and the rules above completely determine the behaviour of the system. The Gosper glider gun is an interesting starting configuration that generates so-called ``gliders'', which propagate across the board.
In principle the size of the board in a cellular automaton is infinite. Of course this is not easy to simulate, but this implementation adds a border of two extra cells around the board on all sides to approximate an infinite board slightly better. These are not visualised, nor returned in the final state.
morph
function, which powers this simulation.gameOfLife(init=gosperGliderGun(), size=c(40,40), steps=50, viz=TRUE)
Run the code above in your browser using DataLab