cellular automata generator (in Go)
More documentation about Automata and their implementation on eliseduverdier.github.io/cellular-automata-go/.
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
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