Conway: A Cellular Automaton Tribute

On April 11, 2020 John Conway died of Covid. Conway made contributions to many branches of mathematics, but is most famous for his invention The Game of Life. Reading about The Game of Life in the Dutch popular scientific magazine “KIJK” made a big impact on me and was one of the factors that lead me to pursue a career in computer science. So when I heard about Conway’s passing I decided to create a little cellular automaton as a tribute. This post is about that tribute.

Game of Life

A cellular automaton consists of a regular grid of cells, each in one of a finite number of states, Each cell changes state based on a set of fixed rules and its neighborhood. The neighborhood of a cell is made up of the cells nearby and in particular of the states of those cells.

The brilliance of the Game of Life is its simplicity of rules that power configurations that show highly complex behaviors. There are only two states: on and off. Only the eight direct neighbors are taken into account. As for the rules, a cell that is off, remains off unless three of its neighbors are on. A cell that is on, remains on only when two or three of its neighbors are on. That’s it!

Take for example this configuration, where the blue cells are on, the white ones off:

Image for post

The middle cell has exactly two neighbors that are on, so it will remain on. The two blue cells on the left and the right though have only one neighbor that is on, so they will switch off. The two white cells just above and below the middle cell have both three neighbors that are switched on and so they will switch on themselves.

With the result:

Image for post

Of course now the roles are reversed and in the next generation the cells above and below will switch off and the cells to the left and right will switch on again.

**Using these primitives you can create all kinds of complex mechanisms. A popular building block is the glider, a group of cells that ‘moves’ in a certain direction by changing its shape a few times until it reappears just the same, but now one cell down and **more to the right:

Image for post

Glider in action

**It doesn’t stop there; people have created **guns that produce new gliders every so many generations, discovered or designed hundreds of space ships and even build systems that behave like computers which proves that the Game of Life is Turing Complete; anything that can be calculated, can be calculated using the right game of life setup (though the boards might be very big indeed).

#processing #artificial-life #artificial-intelligence

What is GEEK

Buddha Community

Conway: A Cellular Automaton Tribute
Ray  Patel

Ray Patel

1623940680

Snake game mixed with Conway's Game of Life for python

SnakeOfLife

Snake game mixed with Conway’s Game of Life

The rules are the same than a normal snake game but you have to avoid cells created by Conway’s Game of Life. New pattern are added every 3, 2 or 1 food eaten (depending the chosen level). However, if one of these cell is in contact with food it turns to food.

Requirements

  • numpy
  • pygame

Usage

You can pass the level (1 to 3) as argument, by default it will be 1.

python snakeoflife.py 3

#games #snake game mixed with conway's game of life for python #snake game mixed #conway's game of life #python #conway's

Conway: A Cellular Automaton Tribute

On April 11, 2020 John Conway died of Covid. Conway made contributions to many branches of mathematics, but is most famous for his invention The Game of Life. Reading about The Game of Life in the Dutch popular scientific magazine “KIJK” made a big impact on me and was one of the factors that lead me to pursue a career in computer science. So when I heard about Conway’s passing I decided to create a little cellular automaton as a tribute. This post is about that tribute.

Game of Life

A cellular automaton consists of a regular grid of cells, each in one of a finite number of states, Each cell changes state based on a set of fixed rules and its neighborhood. The neighborhood of a cell is made up of the cells nearby and in particular of the states of those cells.

The brilliance of the Game of Life is its simplicity of rules that power configurations that show highly complex behaviors. There are only two states: on and off. Only the eight direct neighbors are taken into account. As for the rules, a cell that is off, remains off unless three of its neighbors are on. A cell that is on, remains on only when two or three of its neighbors are on. That’s it!

Take for example this configuration, where the blue cells are on, the white ones off:

Image for post

The middle cell has exactly two neighbors that are on, so it will remain on. The two blue cells on the left and the right though have only one neighbor that is on, so they will switch off. The two white cells just above and below the middle cell have both three neighbors that are switched on and so they will switch on themselves.

With the result:

Image for post

Of course now the roles are reversed and in the next generation the cells above and below will switch off and the cells to the left and right will switch on again.

**Using these primitives you can create all kinds of complex mechanisms. A popular building block is the glider, a group of cells that ‘moves’ in a certain direction by changing its shape a few times until it reappears just the same, but now one cell down and **more to the right:

Image for post

Glider in action

**It doesn’t stop there; people have created **guns that produce new gliders every so many generations, discovered or designed hundreds of space ships and even build systems that behave like computers which proves that the Game of Life is Turing Complete; anything that can be calculated, can be calculated using the right game of life setup (though the boards might be very big indeed).

#processing #artificial-life #artificial-intelligence

Cellular Automaton and Deep Learning

Cellular Automatons (CA) are evolving grid-based computational systems which model complexity growth. In simpler words, cellular automatons are evolving patterns that are unidirectional and chaotic. The rules of evolution are very elementary and simple however, the evolution gives rise to highly complex structures and behaviour. CA have been proposed as models of how complexity grows in the physical chaotic system and how symmetry can emerge from simple laws. A parallel that I like to draw is to compare CA with Statistical Mechanics: The concept of temperature does not exist at a molecular/atomic level for gases. Temperature is not a property of a single molecule. However, when you put millions/billions of molecules in a box the dynamics and kinematics between the molecules give rise to Temperature. We call temperature an “emergent” property of the ensemble. CA behave in a similar way - they follow very simple local rules and a collection of CA gives rise to “emergent” symmetries and complex behaviour.

In this blog we will focus on the most famous example of a 2d CA known as “Game-of-Life” (GOL). This was discovered by the Conway in 1970s. Evolution of a cell depends on its neighbours. A cell has two states — dead (black) or alive (white). The automaton follows these simple rules,

  1. A cell with all dead neighbours dies because of loneliness.
  2. A cell with more than 3 live neighbours dies of starvation
  3. A dead cell with 3 or more live neighbours becomes alive because of reproduction
  4. A cell with 2 or 3 live neighbours remains in the same state — stasis.

We represent all these states in the following figure,

Image for post

Rules for GOL (n = neighbours)

We let a 2d grid of CA evolve over time and obtain interesting structures. The initial starting point is typically random. Certain fixed starting point gives rise to specific structures. People have tried to classify the zoology of the structures that can appear. Let us see some examples of evolution with random initial states,

#deep-learning #interesting #intelligence #cellular-automata #deep learning

One-Dimensional Cellular Automaton in JavaScript

In this article I will write a simple implementation of a 1-dimensional cellular automaton in JavaScript.

The concept of cellular automata has existed since the middle of the 20th century and has grown into a vast field with many practical and theoretical applications.

A cellular automaton consists of any number of “cells” arranged in 1, 2, 3 or more dimensions. Each has a state associated with it (in the simplest case just on or off) and each cell and therefore the entire automaton transitions from one state to the next over time according to a rule or set of rules.

The number of dimensions, the number of possible cell states, and the rules can become arbitrarily large and complex but for this project I will implement the simplest type of one-dimensional cellular automaton, known as an elementary cellular automaton.

The Elementary Cellular Automaton
An elementary cellular automaton consists of a row of cells, each of which can be “on” or “off”, illustrated in the table below with 0s and 1s.

Image for post

For the purposes of calculating the next state of each cell, individual cells are considered to have a “neighbourhood” consisting of the cell itself and the two cells either side. For the cells at the ends one part of the neighbourhood is the cell at the other end, so the automaton can be considered to be logically circular. The next table shows the neighbourhoods of the two cells shown in bold.

Image for post

There are 8 possible neighbourhoods and therefore the rules for setting the next cell state can be represented by a byte. The decimal values 0–255 represented by all possible bytes form what is known as the Wolfram Code after Stephen Wolfram who carried out research in the area and wrote the book A New Kind of Science.

Here is the Wolfram Code for Rule 30, the bits of the second row forming 30 in binary

Image for post

A 1D cellular automaton’s states over time are usually represented by consecutive rows with the states represented by blocks of different colour. In this project I will write an HTML/JavaScript based implementation, and this is a screenshot of a sample run using Rule 109. Some patterns produced can be much more interesting than others.

#programming #web-development #software-development #cellular-automata #javascript

Neural Cellular Automata For Art Recreation

The article will briefly introduce the field of Cellular Automata (CA), along with a Neural Network approach. The outputs of this work are not simply images. They are some form of a virtual organism that, similar to a living body, grows, and responds to changes. This is an experimental work that hopes to encode information in a genome-like fashion.

At the end of this article, we won’t be able to create a virtual human living in San Junipero (shout-out to Black Mirrors fans). However, we will be able to present a recreation of Keith Haring’s icon series (1990). These icons will grow from a single cell until they reach a saturation point, where the single-cell becomes one multicellular entity.

If you are not interested in the technicalities behind the Neural Network architecture feel free to skip sections with titles starting by “CNN:”. I set the code used for this project on a Colab notebook, which can be used to create similar figures and images for user-defined inputs. The notebook is an edited version of Mordvintsev’s work on Growing Neural Cellular Automata [1].

Figure 1: Example of the capabilities of Neural Cellular Automata. The top image is the famous Barking Dog icon by Keith Haring. The bottom set of images is eight different cellular automata models that learned to recreate this icon. The bottom gif is not simply a set of frames. It is a continuously growing and interactive model that starts from a single seed and saturates when it reaches the targeted image. (Top image based on Public Projects Archive. Bottom image by author)


In the early 1950s, Rosalind Franklin, Francis Crick, and James Watson’scollaboration led to the discovery of the DNA [2]. This discovery did create not only the most significant milestone in the development of modern biology but also shaped other fields such as computer science.

#cellular-automata #data-science #art #neural-networks #artificial-intelligence #neural networks