Skip to content

eliseduverdier/cellular-automata-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

57 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

cellular automata generator (in Go)

More documentation about Automata and their implementation on eliseduverdier.github.io/cellular-automata-go/.

GitHub top language GitHub repo size GitHub last commit

CI status codecov Go Report Card Maintainability

Generates elementary cellular automata images, with 2 to 9 states, or 1st and 2nd order, with customizable size, colors, and points distribution, using Go

  • As PNG images (rule 73)

  • Or as text (rule 110)

β–ˆβ–ˆ β–ˆ β–ˆ    β–ˆβ–ˆ  β–ˆβ–ˆβ–ˆ β–ˆ β–ˆβ–ˆβ–ˆ   β–ˆβ–ˆ β–ˆ β–ˆ   β–ˆβ–ˆ   β–ˆ  β–ˆβ–ˆ
       β–ˆ  β–ˆ  β–ˆβ–ˆ         β–ˆ β–ˆ      β–ˆ β–ˆ  β–ˆ β–ˆ β–ˆβ–ˆ
      β–ˆ β–ˆβ–ˆ β–ˆβ–ˆ  β–ˆ       β–ˆ   β–ˆ    β–ˆ   β–ˆβ–ˆ      β–ˆ
     β–ˆ       β–ˆβ–ˆ β–ˆ     β–ˆ β–ˆ β–ˆ β–ˆ  β–ˆ β–ˆ β–ˆ  β–ˆ    β–ˆ β–ˆ
    β–ˆ β–ˆ     β–ˆ    β–ˆ   β–ˆ       β–ˆβ–ˆ     β–ˆβ–ˆ β–ˆ  β–ˆ   β–ˆ
   β–ˆ   β–ˆ   β–ˆ β–ˆ  β–ˆ β–ˆ β–ˆ β–ˆ     β–ˆ  β–ˆ   β–ˆ    β–ˆβ–ˆ β–ˆ β–ˆ
  β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ   β–ˆβ–ˆ       β–ˆ   β–ˆ β–ˆβ–ˆ β–ˆ β–ˆ β–ˆ  β–ˆ
 β–ˆ         β–ˆ β–ˆ  β–ˆ     β–ˆ β–ˆ β–ˆ          β–ˆβ–ˆ β–ˆ
β–ˆ β–ˆ       β–ˆ   β–ˆβ–ˆ β–ˆ   β–ˆ     β–ˆ        β–ˆ    β–ˆ    β–ˆ
   β–ˆ     β–ˆ β–ˆ β–ˆ    β–ˆ β–ˆ β–ˆ   β–ˆ β–ˆ      β–ˆ β–ˆ  β–ˆ β–ˆ  β–ˆ
β–ˆ β–ˆ β–ˆ   β–ˆ     β–ˆ  β–ˆ     β–ˆ β–ˆ   β–ˆ    β–ˆ   β–ˆβ–ˆ   β–ˆβ–ˆ
     β–ˆ β–ˆ β–ˆ   β–ˆ β–ˆβ–ˆ β–ˆ   β–ˆ   β–ˆ β–ˆ β–ˆ  β–ˆ β–ˆ β–ˆ  β–ˆ β–ˆ  β–ˆ
    β–ˆ     β–ˆ β–ˆ      β–ˆ β–ˆ β–ˆ β–ˆ     β–ˆβ–ˆ     β–ˆβ–ˆ   β–ˆβ–ˆ
   β–ˆ β–ˆ   β–ˆ   β–ˆ    β–ˆ       β–ˆ   β–ˆ  β–ˆ   β–ˆ  β–ˆ β–ˆ  β–ˆ
β–ˆ β–ˆ   β–ˆ β–ˆ β–ˆ β–ˆ β–ˆ  β–ˆ β–ˆ     β–ˆ β–ˆ β–ˆ β–ˆβ–ˆ β–ˆ β–ˆ β–ˆβ–ˆ   β–ˆβ–ˆ β–ˆ

Use locally

PORT=8888 go run main.go

Then go to http://localhost:8888/text or http://localhost:8888/image and use GET parameters (listed below)

Exemple of nice automatas

Order 1  /  2 states  /  Rule # 150 Order 1  /  2 states  /  Rule # 73 Order 1  /  3 states  /  Rule # 78271914 Order 1  /  3 states  /  Rule # 76148092

Order 2  /  2 states  /  Rule # 24987 Order 2  /  2 states  /  Rule # 56922 Order 2  /  2 states  /  Rule # 5198 Order 2  /  2 states  /  Rule # 58937 Order 2  /  2 states  /  Rule # 37486

parameters

option role
s number of states (>2)
o order (1 or 2)
r rule number
w width in pixels
h height in pixels
p size of one cell in pixels (1 < p < 20)
start first line strategy ("random", "centered", "left", "right", see below)
line a sequence of numbers representing the first line like "0000010..."

Run tests

# run tests
make test
# generate code coverage
make coverage
# lint (needs https://golangci-lint.run/)
make lint

Etc

Todo

  • add docker
  • add option to get dots bigger than 1px
  • add option to choose custom colors
  • Cache when rule isn't random

install latest go version on ubuntu

sudo apt-get purge golang\*
sudo add-apt-repository ppa:longsleep/golang-backports
sudo apt update
sudo apt install golang-go