totalistic

package
v0.0.0-...-32cbd93 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Neighbors = func(coord core.Coordinate) []core.Coordinate {
	left := core.Coordinate{(coord[0] - 1)}
	right := core.Coordinate{(coord[0] + 1)}
	return []core.Coordinate{left, right}
}

Functions

func AddTotalisticToImage

func AddTotalisticToImage(ca *core.CellularAutomata[int], img *image.Gray, stepNum, scale, length int)

func MainTotalistic

func MainTotalistic(ruleNum, length, steps, scale int, initConfig []core.Coordinate)

func SetCenterConfig

func SetCenterConfig(length int) []core.Coordinate

func SetRandomConfig

func SetRandomConfig(length int) []core.Coordinate

func TotalisticCellularAutomata

func TotalisticCellularAutomata(ruleNum, length, steps int) *core.CellularAutomata[int]

func TotalisticRuleSet

func TotalisticRuleSet(ruleNumber int) core.RuleSet[int]

totalistic rule numbers correspond to a sequence of base 3 digits

we consider the average of the 3 states in the neighborhood. there are 7 possible averages: 2, 5/3, 4/3, 1, 2/3, 1/3, 0

thus we have 3^7 = 2187 total possible rules

now we can encode a rule as a base 3 number where each average is mapped to a state for example: 2 -> 1 5/3 -> 2 4/3 -> 0 1 -> 2 2/3 -> 1 1/3 -> 0 0 -> 2

this rule, in base 3 is: 1202102, so the base 10 rule number is: 1280

Types

This section is empty.

Jump to

Keyboard shortcuts

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