life

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

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

Field contains all informations about the current status of all cells

func GenerateFirstRound

func GenerateFirstRound(width, height int) *Field

GenerateFirstRound generates a new field with a (pseudo) random seed

func LoadFirstRound

func LoadFirstRound(width, height int, filename string) *Field

LoadFirstRound wraps LoadFirstRoundFromTXT or LoadFirstRoundFromRLE depending on the file extension

func LoadFirstRoundFromRLE added in v0.9.0

func LoadFirstRoundFromRLE(width, height int, filename string) *Field

LoadFirstRound generates a new field from a rle-text-file

func LoadFirstRoundFromTXT added in v0.9.0

func LoadFirstRoundFromTXT(width, height int, filename string) *Field

LoadFirstRound generates a new field from a text-file

func (*Field) GetCells

func (field *Field) GetCells() [][]int

GetCells returns the non-public cells value of the field

func (*Field) LivingNeighbors added in v0.10.0

func (field *Field) LivingNeighbors(x, y int) int

LivingNeighbors returns the number of living neighbors of a cell

func (*Field) NextRound

func (field *Field) NextRound() *Field

NextRound looks at every cell and calculates its new value, it returns the new field

func (*Field) NextVitality added in v0.10.0

func (field *Field) NextVitality(x, y int) int

NextVitality returns the vitality of a cell in the next round

func (*Field) PrintField

func (field *Field) PrintField() string

PrintField returns a string representing the value of all cells

Jump to

Keyboard shortcuts

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