gautomata

command module
v0.0.0-...-94bae1f Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: MIT Imports: 14 Imported by: 0

README

The cellular automaton consists of a line of cells, each colored either black or white. At every step there is then a definite rule that determines the color of a given cell from the color of that cell and its immediate left and right neighbors on the step before.

-Stephen Wolfram (A New Kind of Science, 2004)

Overview

gautomata is a cellular automata renderer meant to generate wallpaper-size images of various cellular automata. Some of the available automata are well outside the simplistic bounds described by Stephen Worlfram's quote above, but that doesn't make them any less cellular and/or fun.

gautomata is written in the Go programming language to keep my Go skills sharp.

This project was heavily inspired by trasevol_dog's writings on and experiments with cellular automata.

Sample

Sample

Installation

go get github.com/jessemillar/gautomata

Usage

usage: gautomata [<flags>]

Flags:
      --help                   Show context-sensitive help (also try --help-long and --help-man).
  -w, --width=256              The width of the resulting image.
  -h, --height=256             The height of the resulting image.
  -c, --colors=5               The number of colors in the generated color palette.
  -l, --list                   List the supported automata.
  -a, --automata="random"      The automata to execute.
  -b, --batch                  Whether or not to automatically name the resulting images.
  -o, --output="automata.png"  The filename of the resulting image.

Tips

gautomata is not capable of generating scaled images. If you wish to more easily see pixels in your resulting images, combining gautomata with something like ImageMagick could be useful.

The following bash/zsh function uses gautomata to generate automata images and uses ImageMagick to scale them to MacBook Pro screen resolutions.

function cells() {
        if [ -z $1 ]
        then
                echo "No iteration count supplied"
        else
                for i in {1..$1}
                do
                        WIDTH=960
                        HEIGHT=600

                        if [ -z $2 ]
                        then
                                gautomata -w $WIDTH -h $HEIGHT -b -a random
                        else
                                gautomata -w $WIDTH -h $HEIGHT -b -a $2
                        fi
                done

                echo "Scaling images"
                mogrify -scale 5760x3600+0+0 *.png
        fi
}

Notes

This repository uses gvt for package management. Below is a list of dependencies and their versions that can be found in the /vendor directory.

gvt fetch -tag v2.2.5 gopkg.in/alecthomas/kingpin.v2

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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