cellularautomata

package
v0.0.0-...-e6422fb Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeadOOB

func DeadOOB(_ *CellularAutomata[int]) func(int, int, bool, bool, bool, bool) *Cell[int]

dead oob

func LiveOOB

func LiveOOB(_ *CellularAutomata[int]) func(int, int, bool, bool, bool, bool) *Cell[int]

live oob

func NothingOOB

func NothingOOB[T any](ca *CellularAutomata[T]) func(int, int, bool, bool, bool, bool) *Cell[T]

func OverflowOOB

func OverflowOOB[T any](ca *CellularAutomata[T]) func(int, int, bool, bool, bool, bool) *Cell[T]

wrapping oob

func RandomBottomOOB

func RandomBottomOOB(_ *CellularAutomata[int]) func(int, int, bool, bool, bool, bool) *Cell[int]

random bottom oob

func RandomOOB

func RandomOOB(_ *CellularAutomata[int]) func(int, int, bool, bool, bool, bool) *Cell[int]

random oob

Types

type Cell

type Cell[T any] struct {
	X, Y      int
	IsBound   bool
	State     [2]T
	Neighbors []*Cell[T]
}

func NewCell

func NewCell[T any](x, y int) *Cell[T]

type CellularAutomata

type CellularAutomata[T any] struct {
	ReadIndex, WriteIndex int
	// contains filtered or unexported fields
}

func NewCellularAutomata

func NewCellularAutomata[T any](
	xMax, yMax int,
	ruleFunc func(*Cell[T], *CellularAutomata[T]) T,
	colorFunc func(T) color.NRGBA,
	oobCellFunc func(*CellularAutomata[T]) func(int, int, bool, bool, bool, bool) *Cell[T],
	initFillFunc func(*Cell[T], *CellularAutomata[T]) T,
) *CellularAutomata[T]

func (*CellularAutomata[T]) Bounding

func (ca *CellularAutomata[T]) Bounding(x, y int) *Cell[T]

func (*CellularAutomata[T]) GenerateNextState

func (ca *CellularAutomata[T]) GenerateNextState()

func (*CellularAutomata[T]) GetCellAt

func (ca *CellularAutomata[T]) GetCellAt(x, y int) *Cell[T]

func (*CellularAutomata[T]) GetImageFromCurrentState

func (ca *CellularAutomata[T]) GetImageFromCurrentState() image.Image

Jump to

Keyboard shortcuts

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