Conway's game of life

Conway's game of life

Details

A community_matrixmodel where each cell contains or not an individual. At each generation, an individual may survive or not and empty cells be filled by a new individual.

The survival and generation rules are fixed by the number of neighbors of each cell. Edge effects are eliminated by a toroidal correction.

Public fields

to_survive

The number of neighbors necessary for an individual to survive. Default is 2:3.

to_generate

The number of neighbors necessary for an empty cell to generate an individual. Default is 3.

Methods

Inherited methods


Method new()

Create a new instance of this R6 class.

Usage

cm_Conway$new(
  pattern = pattern_matrix_individuals(),
  timeline = 0,
  type = "Alive",
  neighborhood = "Moore 1"
)

Arguments

pattern

The pattern which describes the location of agents.

timeline

A numeric vector that contains the points of time of interest.

type

The type of individuals. Informational only.

neighborhood

A character string defining what is the neighborhood of a cell: "von Neumann 1" or "4" for the closest four neighbors (North, West, South, East); "Moore 1" or "8" for all adjacent cells (the first four and North-West, etc.); "Moore 2" or "24" for two rings of neighbors.


Method clone()

The objects of this class are cloneable with this method.

Usage

cm_Conway$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.