automata

package
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: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCenteredLine

func GetCenteredLine(length int, states int) []int

GetCenteredLine

func GetMaxRule

func GetMaxRule(maxStatesCombi int) float64

GetMaxRule the higher rule number possible

func GetMaxStatesCombinaisons

func GetMaxStatesCombinaisons(states int, order int) int

GetMaxStatesCombinaisons the maximum number of combinaisons from the states & used number of cells

func GetPixelsOnLeft

func GetPixelsOnLeft(length int, states int) []int

GetPixelsOnLeft

func GetPixelsOnRight

func GetPixelsOnRight(length int, states int) []int

GetPixelsOnRight

func GetRandomLine

func GetRandomLine(length int, states int) []int

GetRandomLine

func Reverse

func Reverse(number string) []int

Reverse invert the number as string, to render as an array of int 12110 -> [0, 1, 1, 2, 1]

func RuleToArray

func RuleToArray(states int, order int, ruleNumber float64) []int

RuleToArray Generates an associative array, where N cells with S states generate a new cell Basic cellular automata (2 states, 1st order), based on the 3 cells above. For example, for the rule 30 (11110 in base 2), the array map these values : current pattern : 111 (7) 110 (6) 101 (5) 100 (4) 011 (3) 010 (2) 001 (1) 000 (0) new state for center cell: 0 0 0 1 1 1 1 0

Types

type CellularAutomata

type CellularAutomata struct {
	States     int
	Order      int
	Columns    int
	Rows       int
	RuleNumber float64
	FirstLine  FirstLine
}

CellularAutomata The cellular automata structure

func (CellularAutomata) GetMatrix

func (c CellularAutomata) GetMatrix() [][]int

GetMatrix Builds the matrix line after line

func (CellularAutomata) GetMetadata

func (c CellularAutomata) GetMetadata() map[string]int

GetImageName Returns the properties of the automata (states, order, and rule number)

type FirstLine

type FirstLine struct {
	Sequence []int
}

Jump to

Keyboard shortcuts

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