Conway’s GameOfLife#

This model implements Conway’s Game of Life as well as all two-dimensional life-like cellular automata. For information on the model and its generalization to two-dimensional rules, please have a look at the linked Wikipedia articles and, if needed, follow the references presented in the articles.

Default Model Configuration#

Below are the default configuration parameters for the GameOfLife model:

# --- Space parameters
# The physical space this model is embedded in
space:
  periodic: true

# --- CellManager and cell initialization
cell_manager:
  grid:
    structure: square
    resolution: 128      # in cells per unit length of physical space

  neighborhood:
    mode: Moore

# --- Initialization 
# Initialize cells that should be set to living.
# This feature uses the `select_entities` interface; consult the
# documentation regarding information on available selection modes.
# Turn dead cells into living cells. All cells that do not fulfill the 
# condition are set to be dead.
living:
  mode: probability

  # Probability parameter
  probability: 0.1

  # Clustering parameters
  p_seed: .02            # Probability with which a cell is a cluster seed
  p_attach: .1           # Attachment probability (per neighbor)
  num_passes: 5          # How many attachment procedures to perform

# --- Rule specification
# Specify a rule in the notation used by Mirek's Cellebration as a string in
# in form `x/y` with:
#   - `x`: The number of neighbors required for a cell to get born
#   - `y`: The number of neighbors required to survive
# In this notation, the game of life is given as `3/23`
rule: 3/23

Available Plots#

The following plot configurations are available for the GameOfLife model:

Default Plot Configuration#

# Animation of the cellular automaton state
ca/state:
  based_on: ca/state

ca/state_final:
  based_on:
    - ca/state
    - .plot.ca.snapshot

# Density time development of living cells
density_living_cells:
  based_on: density_living_cells

Base Plot Configuration#

.variables:
  base_path: &base_path data/GameOfLife

  # The discretized colormap used here, mapping to states 0 and 1, respectively
  cmap: &cmap
    empty: &color_empty     white
    living: &color_living   cornflowerblue



# =============================================================================
#  ╔╦╗╔═╗╔╦╗╔═╗╦  ╔═╗╔╦╗╔═╗╔═╗
#   ║ ║╣ ║║║╠═╝║  ╠═╣ ║ ║╣ ╚═╗
#   ╩ ╚═╝╩ ╩╩  ╩═╝╩ ╩ ╩ ╚═╝╚═╝
# =============================================================================
# -- Overloads ----------------------------------------------------------------
# Overload some configs to insert model-specific settings

# Model-specific defaults
.defaults:
  based_on: .defaults

  # Can define something here ...


# .. Creators .................................................................
.creator.universe:
  based_on:
    - .creator.universe
    - .defaults

  dag_options:
    select_path_prefix: *base_path

.creator.multiverse:
  based_on:
    - .creator.multiverse
    - .defaults

  select_and_combine:
    base_path: *base_path





# =============================================================================
#  ╔═╗╦  ╔═╗╔╦╗╔═╗
#  ╠═╝║  ║ ║ ║ ╚═╗
#  ╩  ╩═╝╚═╝ ╩ ╚═╝
# =============================================================================

# A state animation of the cellular automaton
ca/state:
  based_on:
    - .creator.universe
    - .plot.ca

  select:
    living: living

  to_plot:
    living:
      title: " "
      add_colorbar: false
      cmap: *cmap



# The mean density of living cells
density_living_cells:
  based_on:
    - .creator.multiverse
    - .plot.facet_grid.with_auto_encoding
    - .plot.facet_grid.line
    - .hlpr.kind.time_series
    - .hlpr.limits.y.from_zero

  select_and_combine:
    fields:
      living: living

  transform:
    # The 'data' provided to the facet_grid plot function is the mean over
    # the 'x' and 'y' dimension. Due to the fact that living is represented as
    # 1 and dead as 0, calculating the mean over all grid cells automatically
    # results in the density
    - .mean: [!dag_tag living, ['x', 'y']]
      tag: data

  helpers:
    set_labels:
      y: Density of living cells
      only_label_outer: true

  color: *color_living

For available base plots, see Base Plot Configuration Pool.

Possible Future Extensions#

This model can be expanded in many different ways. A few ideas are:

  • Expand the initialization options to position well-known structures such as gliders or space-ships at desired locations on the grid.

  • Introduce stochasticity into the model by introducing birth and/or death probabilities. For these cases, also provide means to plot and analyze the data.

References#