Documentation ¶
Index ¶
- Constants
- type Gol
- func (g *Gol) ChangeCells(changes [][]int) base.GolInterface
- func (g *Gol) Clone() base.GolInterface
- func (g *Gol) Cols() int
- func (g *Gol) DbgStdout()
- func (g *Gol) Description() string
- func (g *Gol) Equals(o base.GolInterface) bool
- func (g *Gol) EqualsError(o base.GolInterface) error
- func (g *Gol) FastForward(generations int) base.GolInterface
- func (g *Gol) Generation() int
- func (g *Gol) Get(i int, j int) int
- func (g *Gol) GridEquals(o base.GolInterface, mode string) bool
- func (g *Gol) InitFromConf(name, description string, rows, cols int, gconf *base.GolConf)
- func (g *Gol) InitWithGrid(name, description, rules string, generation, neighborhoodType int, ...)
- func (g *Gol) LimitCols() bool
- func (g *Gol) LimitRows() bool
- func (g *Gol) Name() string
- func (g *Gol) NeighborhoodType() int
- func (g *Gol) NeighborhoodTypeString() string
- func (g *Gol) NextGeneration() base.GolInterface
- func (g *Gol) Processes() int
- func (g *Gol) Rows() int
- func (g *Gol) Rules() string
- func (g *Gol) Set(i int, j int, value int)
- func (g *Gol) SetAll(value int)
- func (g *Gol) SetGeneration(generation int)
- func (g *Gol) SetLimitCols(limitRows bool)
- func (g *Gol) SetLimitRows(limitRows bool)
- func (g *Gol) SetNeighborhoodType(neighborhoodType int)
- func (g *Gol) SetNeighborhoodTypeString(neighborhoodType string)
- func (g *Gol) SetProcesses(processes int)
- func (g *Gol) SetRules(rules string)
- func (g *Gol) SetThreadPoolSize(threadPoolSize int)
- func (g *Gol) ThreadPoolSize() int
Constants ¶
const CPUS = -1
CPUS : if assigned to Gol.Processes a number of GO processes equal to the number of CPUs of the computer will be used when computing the next generation.
const DefaultThreadPoolSize = 10
DefaultThreadPoolSize : default number of threads used in the thread pool to compute next generation of a game of life instance.
const ExplosiveThreadPoolSize = -1
ExplosiveThreadPoolSize : the thread pool will use a thread for each cell do not use it unless you want to experiment with your memory limits.
const SERIAL = 1
SERIAL : if assigned to Gol.Processes, a serial algorithm (i.e. no concurrency) will be used when computing the next generation.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gol ¶
type Gol struct {
// contains filtered or unexported fields
}
Gol : game of life
func NewGol ¶
func NewGol(name, description, rules, gridType, rowsLimitation, colsLimitation string, rows, cols, generation int) *Gol
NewGol : creates a game of life
func NewRandomGol ¶
func NewRandomGol(name, description, rules, gridType, rowsLimitation, colsLimitation string, rows, cols int, randomSeed int64) *Gol
NewRandomGol : creates a new random game of life
func (*Gol) ChangeCells ¶
func (g *Gol) ChangeCells(changes [][]int) base.GolInterface
ChangeCells : apply cell changes before a new generation This method is used by NextGeneration to allow input data on the Game of Life instance
func (*Gol) Description ¶
Description : return the description of this Game of life instance
func (*Gol) Equals ¶
func (g *Gol) Equals(o base.GolInterface) bool
Equals : inform if two game of life instances have the same data
func (*Gol) EqualsError ¶
func (g *Gol) EqualsError(o base.GolInterface) error
EqualsError : inform if two game of life instances have the same data by returning an error if different, or nil otherwise.
func (*Gol) FastForward ¶
func (g *Gol) FastForward(generations int) base.GolInterface
FastForward : move forward a number of generations
func (*Gol) Generation ¶
Generation : return the number of generations passed
func (*Gol) GridEquals ¶
func (g *Gol) GridEquals(o base.GolInterface, mode string) bool
GridEquals : inform if two game of life instances have the same data,
ignoring the difference in generations value
func (*Gol) InitFromConf ¶
InitFromConf : initialize a Game of Life instance
func (*Gol) InitWithGrid ¶
func (g *Gol) InitWithGrid(name, description, rules string, generation, neighborhoodType int, gr *grid.Grid)
InitWithGrid : initialize a Game of Life instance
func (*Gol) NeighborhoodType ¶
NeighborhoodType : return the neighborhood type
func (*Gol) NeighborhoodTypeString ¶
NeighborhoodTypeString : return the neighborhood type (as string)
func (*Gol) NextGeneration ¶
func (g *Gol) NextGeneration() base.GolInterface
NextGeneration : compute the next generation If no prior change to the generation of the next game of life instance, pass a nil in the place of changes parameter.
func (*Gol) Processes ¶
Processes : return the number of GO processes used in the computing of the next generation. Take account the constants SERIAL and CPUS of this package.
func (*Gol) Rules ¶
Rules : return the rules of the game of life as a string with the survival/birth format. See https://www.conwaylife.com/wiki/Life_1.05
func (*Gol) SetGeneration ¶
SetGeneration : set generation passed
func (*Gol) SetLimitCols ¶
SetLimitCols : set if cols are limited or isn't
func (*Gol) SetLimitRows ¶
SetLimitRows : set if rows are limited or isn't
func (*Gol) SetNeighborhoodType ¶
SetNeighborhoodType : return the neighborhood type
func (*Gol) SetNeighborhoodTypeString ¶
SetNeighborhoodTypeString : return the neighborhood type (as string)
func (*Gol) SetProcesses ¶
SetProcesses : set the number of GO processes used in the computing of the next generation. Take account the constants SERIAL and CPUS of this package.
func (*Gol) SetRules ¶
SetRules : set rules according with the survival/birth format. See https://www.conwaylife.com/wiki/Life_1.05
func (*Gol) SetThreadPoolSize ¶
SetThreadPoolSize : set the number of threads that will be used when the parallel next generation algorithm is used.
func (*Gol) ThreadPoolSize ¶
ThreadPoolSize : get the number of threads that will be used when the parallel next generation algorithm is used.