Documentation ¶
Overview ¶
Package conway defines interfaces to generate animations of the Conway's game of life.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoordEqual ¶
CoordEqual returns if two coordinates refer to the same cell.
Types ¶
type Animator ¶
type Animator interface { // Add adds a grid to the collection to be used as a photogram in the animate method. Add(Grid) error // Encode creates an animation of all the added photograms and store it in // the given writer. Encode(w io.Writer) error }
Animator represents a collection of grids that can be rendered in a graphical format and stored in a file.
type Coord ¶
type Coord interface { // X returns the cell's abscissa. X() int // Y returns the cell's ordinate. Y() int }
Coord represents the position of a cell in a grid.
type Grid ¶
type Grid interface { // Width returns the width of the universe (number of cells). Width() int // Height returns the height of the universe (number of cells). Height() int // IsAlive returns if the cell at coordinates x, y is alive. // Returns an error if x or y are out of bounds. IsAlive(Coord) (bool, error) }
Grid represents an inmutable snapshot of a universe.
Click to show internal directories.
Click to hide internal directories.