Struct conway::Universe [] [src]

pub struct Universe { /* fields omitted */ }

Represents a wrapping universe in Conway's game of life.

Methods

impl Universe
[src]

Instantiate a new blank universe with the given width and height, in cells. The universe is at generation 1.

Return width in cells.

Return height in cells.

Get the latest generation number (1-based).

Compute the next generation. Returns the new latest generation number.

Iterate over every non-dead cell in the universe for the current generation. region is the rectangular area used for restricting results. visibility is an optional player_id; if specified, causes cells not visible to the player to be passed as CellState::Fog to the callback.

Callback receives (x, y, cell_state).

Iterate over every non-dead cell in the universe for the current generation. visibility is an optional player_id, allowing filtering based on fog. Callback receives (x, y, cell_state).

Get a Region of the same size as the universe

Trait Implementations

impl Display for Universe
[src]

Formats the value using the given formatter. Read more