simulations

package
v0.0.0-...-8ad53de Latest Latest
Warning

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

Go to latest
Published: May 8, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CellularAutomata

type CellularAutomata struct {
	// contains filtered or unexported fields
}

CellularAutomata simulates a scenario where cells in a 2-dimensional world can hunt and eat each other based on a set of simple parameters.

func NewCellularAutomata

func NewCellularAutomata(cfg models.SimulationConfig) (*CellularAutomata, error)

NewCellularAutomata initializes and returns a new cellular automata simulation

func (*CellularAutomata) AdvanceFrame

func (s *CellularAutomata) AdvanceFrame(g *models.Grid) error

AdvanceFrame determines and assigns the next state of each organism's parameters.

func (*CellularAutomata) DrawSpace

func (s *CellularAutomata) DrawSpace(
	sp *models.Space,
	img *image.Paletted,
	x int,
	y int,
) error

DrawSpace colors the image at the specified location according to the properties of the Space.

func (*CellularAutomata) GetPalette

func (s *CellularAutomata) GetPalette() color.Palette

GetPalette returns the simulation's color palette

func (*CellularAutomata) InitializeGrid

func (s *CellularAutomata) InitializeGrid(g *models.Grid) error

InitializeGrid instantiates a grid

func (*CellularAutomata) OutputName

func (s *CellularAutomata) OutputName() (string, error)

OutputName creates an output file path based on parameters of the simulation

type CellularAutomataConfig

type CellularAutomataConfig struct {
	// contains filtered or unexported fields
}

CellularAutomataConfig holds the configurations for the cellular automata simulation

type SlimeMold

type SlimeMold struct {
	// contains filtered or unexported fields
}

SlimeMold simulates a slime mold that leaves behind scent trails and creates networks based on where other mold particles have been.

func NewSlimeMold

func NewSlimeMold(cfg models.SimulationConfig) (*SlimeMold, error)

NewSlimeMold initializes and returns a new slime mold simulation

func (*SlimeMold) AdvanceFrame

func (s *SlimeMold) AdvanceFrame(g *models.Grid) error

AdvanceFrame determines and assigns the next state of each organism's parameters.

func (*SlimeMold) DrawSpace

func (s *SlimeMold) DrawSpace(
	sp *models.Space,
	img *image.Paletted,
	x int,
	y int,
) error

DrawSpace colors the image at the specified location according to the properties of the Space.

func (*SlimeMold) GetPalette

func (s *SlimeMold) GetPalette() color.Palette

GetPalette returns the simulation's color palette

func (*SlimeMold) InitializeGrid

func (s *SlimeMold) InitializeGrid(g *models.Grid) error

InitializeGrid instantiates a grid

func (*SlimeMold) OutputName

func (s *SlimeMold) OutputName() (string, error)

OutputName creates an output file path based on parameters of the simulation

type SlimeMoldConfig

type SlimeMoldConfig struct {
	// contains filtered or unexported fields
}

SlimeMoldConfig holds the configurations for the slime mold simulation

Jump to

Keyboard shortcuts

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