biologist: git.sr.ht/~hokiegeek/biologist Index | Files

package biologist

import "git.sr.ht/~hokiegeek/biologist"

Index

Package Files

analysisList.go biologist.go manager.go stabilityDetector.go

Constants

const (
    // Seeded status means that a seed has been applied but the simulation has not started
    Seeded status = iota
    // Active means the simulation is running and is actively evolving
    Active
    // Stable applies to a simulation that has entered a cycle where all that are left are still life and oscillators
    Stable
    // Dead applies to a simulation where all of the living cells were wiped outP
    Dead
)
const (
    // Born applies to a cell who was born in the current generation
    Born changeType = iota
    // Died applies to a cell which died in the current generation
    Died
)

type Analysis Uses

type Analysis struct {
    Status status
    Living []life.Location
}

Analysis provides the state of each analyzed generation

func (*Analysis) Clone Uses

func (t *Analysis) Clone() *Analysis

Clone creates a deep copy of the indicated Analysis

func (*Analysis) String Uses

func (t *Analysis) String() string

type Biologist Uses

type Biologist struct {
    ID   []byte
    Life *life.Life
    // contains filtered or unexported fields
}

Biologist runs a Life simulation and analysis each generation for emerging patterns

func New Uses

func New(dims life.Dimensions, seed func(life.Dimensions, life.Location) []life.Location, rulesTester func(int, bool) bool) (*Biologist, error)

New creates a new biologist with the indicated life board dimension, seed and ruleset

func (*Biologist) Analysis Uses

func (t *Biologist) Analysis(generation int) *Analysis

Analysis returns the completed analysis of the indicated generation

func (*Biologist) Start Uses

func (t *Biologist) Start()

Start beings the Life simulation and analyzes each generation

func (*Biologist) Stop Uses

func (t *Biologist) Stop()

Stop ends the analysis and simulation

func (*Biologist) String Uses

func (t *Biologist) String() string

type Manager Uses

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

Manager keeps track of all Biologist instances

func NewManager Uses

func NewManager() *Manager

NewManager creates a new instance of the Biologist manager

func (*Manager) Add Uses

func (t *Manager) Add(biologist *Biologist)

Add keeps track of a new Biologist instance

func (*Manager) Biologist Uses

func (t *Manager) Biologist(id []byte) *Biologist

Biologist returns the instalce of Biologist with the given ID

func (*Manager) Remove Uses

func (t *Manager) Remove(id []byte)

Remove deletes the Biologist instance of the given ID

Package biologist imports 11 packages (graph). Updated 2019-09-16. Refresh now. Tools for package owners.