cellular-automata-go

command module
v0.0.0-...-4840561 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2021 License: Unlicense Imports: 1 Imported by: 0

README

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

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL