Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Rule2x2 = Rule{ Name: "2x2", Survives: []int{1, 2, 5}, Born: []int{3, 6}, }
View Source
var Rule34Life = Rule{ Name: "34Life", Survives: []int{3, 4}, Born: []int{3, 4}, }
View Source
var RuleAmoeba = Rule{ Name: "Amoeba", Survives: []int{1, 3, 5, 8}, Born: []int{3, 5, 7}, }
View Source
var RuleAssimilation = Rule{ Name: "Assimilation", Survives: []int{4, 5, 6, 7}, Born: []int{3, 4, 5}, }
View Source
var RuleCoagulations = Rule{ Name: "Coagulations", Survives: []int{2, 3, 5, 6, 7, 8}, Born: []int{3, 7, 8}, }
View Source
var RuleCoral = Rule{ Name: "Coral", Survives: []int{4, 5, 6, 7, 8}, Born: []int{3}, }
View Source
var RuleDayAndNight = Rule{ Name: "DayAndNight", Survives: []int{3, 5, 6, 7, 8}, Born: []int{3, 6, 7, 8}, }
View Source
var RuleDefault = Rule{ Name: "Default", Survives: []int{2, 3}, Born: []int{3}, }
View Source
var RuleDiamoeba = Rule{ Name: "Diamoeba", Survives: []int{5, 6, 7, 8}, Born: []int{3, 5, 6, 7, 8}, }
View Source
var RuleFlakes = Rule{ Name: "Flakes", Survives: []int{0, 1, 2, 3, 4, 5, 6, 7, 8}, Born: []int{3}, }
View Source
var RuleGnarl = Rule{ Name: "Gnarl", Survives: []int{1}, Born: []int{1}, }
View Source
var RuleHighLife = Rule{ Name: "HighLife", Survives: []int{2, 3}, Born: []int{3, 6}, }
View Source
var RuleInverseLife = Rule{ Name: "InverseLife", Survives: []int{2, 3, 6, 7, 8}, Born: []int{0, 1, 2, 3, 4, 7, 8}, }
View Source
var RuleLongLife = Rule{ Name: "LongLife", Survives: []int{5}, Born: []int{3, 4, 5}, }
View Source
var RuleMaze = Rule{ Name: "Maze", Survives: []int{1, 2, 3, 4, 5}, Born: []int{3}, }
View Source
var RuleMazectric = Rule{ Name: "Mazectric", Survives: []int{1, 2, 3, 4}, Born: []int{3}, }
View Source
var RuleMove = Rule{ Name: "Move", Survives: []int{2, 4, 5}, Born: []int{3, 6, 8}, }
View Source
var RulePseudoLife = Rule{ Name: "PseudoLife", Survives: []int{2, 3, 8}, Born: []int{3, 5, 7}, }
View Source
var RuleReplicator = Rule{ Name: "Replicator", Survives: []int{1, 3, 5, 7}, Born: []int{1, 3, 5, 7}, }
View Source
var RuleSeeds = Rule{ Name: "Seeds", Survives: []int{}, Born: []int{2}, }
View Source
var RuleServiettes = Rule{ Name: "Serviettes", Survives: []int{}, Born: []int{2, 3, 4}, }
View Source
var RuleStains = Rule{ Name: "Stains", Survives: []int{2, 3, 5, 6, 7, 8}, Born: []int{3, 6, 7, 8}, }
View Source
var RuleWalledCities = Rule{ Name: "WalledCities", Survives: []int{2, 3, 4, 5}, Born: []int{4, 5, 6, 7, 8}, }
View Source
var ThemeBlackOnWhite = Theme{ Name: "BlackOnWhite", Background: tcell.NewRGBColor(255, 255, 255), Foreground: tcell.NewRGBColor(51, 51, 51), CellColor: tcell.NewRGBColor(34, 34, 34), }
View Source
var ThemeWhiteOnBlack = Theme{ Name: "WhiteOnBlack", Background: tcell.NewRGBColor(51, 51, 51), Foreground: tcell.NewRGBColor(255, 255, 255), CellColor: tcell.NewRGBColor(250, 250, 250), }
Functions ¶
func ListThemes ¶
func ListThemes()
Types ¶
type CellState ¶
type CellState int
CellState represents the state of a cell 0 is dead and 1 is alive
type Dimension ¶
type Dimension struct {
// contains filtered or unexported fields
}
Dimension represents the start coordinates as well as width and height of an entity
type Game ¶
type Game struct { Screen tcell.Screen PresetPattern *life.Pattern Header *Header Board *Board Paused bool EdgeWrap bool FPS int Rule Rule Theme Stats }
Game represents a game of life simulation
func (*Game) Init ¶
Init sets the initial pattern of cells on the grid and resets the generation count
func (*Game) NextGen ¶
func (g *Game) NextGen()
NextGen computes the next generation of cells in the grid
func (*Game) SelectRule ¶
SelectRule selects a rule from the rulelist The default is Conway's Game of Life
func (*Game) SelectTheme ¶
SelectTheme sets the theme colours
Click to show internal directories.
Click to hide internal directories.