Skip to content

Life-like cellular automaton simulation tool written in Go

Notifications You must be signed in to change notification settings

fplonka/go-llca

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overview

go-llca is a life-like cellular automaton simulation tool written in Go. It is built to allow easy experimentation with different automaton rules while being very performant: go-llca is multithreaded and can smoothly simulate boards with millions of cells.

go-llca also makes it possible to export crisp GIFs of the performed simulations.

out2

What are life-like cellular automata?

The most famous example of an LLCA is Conway's Game of Life: a 2D grid of cells, each of which is either dead or alive. The grid is repeatedly updated based on very simple rules:

  1. Any dead cell with exactly 3 live neighbors becomes a live cell (birth rule).
  2. Any live cell with exactly 2 or 3 live neighbors survives (survival rule).
  3. All other live cells die in the next generation. Similarly, all other dead cells stay dead.

Life-like cellular automata are just like that, except we allow different birth and survival rules. For example, we may have an LLCA where a live cell is born from any dead cell which has 2, 3, 4, or 7 live neighbors, and any live cell survives if it has 3 or 5 live neighbors. We can then concisely write this rule as B2347/S35.

These sorts of simple rules, when iterated many times, can give rise to surprisingly complex patterns. Examples generated using go-llca are shown in the gallery below.

Installation

To clone and build (requires Go 1.18 or newer):

$ git clone https://github.com/fplonka/go-llca.git
$ cd go-llca
$ go build .

Then run with:

$ ./go-llca

Gallery

WARNING: Some of the following animations contain rapidly flashing lights.

B3/S23 (Conway's Game of Life):

B3/S23

B34/S2678:

B34/S2678

B4678/S35678:

B4678/S35678

B45678/S2345:

B45678/S2345

B2/S678:

B2/S678

B23/S1:

B23/S1

B34/S234567:

B34/S234567

B378/S245678:

B378/S245678

B3578/S24678:

B3578/S24678

About

Life-like cellular automaton simulation tool written in Go

Resources

Stars

Watchers

Forks

Packages