<< concat Game of Life of Conway evolution >>

Game of Life of Conway >> Game of Life of Conway > conway

conway

Compute the next generation of a given grid

Syntax

[B]=conway(A,cyc,fig)

Parameters

A:

matrix with configuration of the original grid

cyc:

%t for infinite periodic arrangement or %f for finite grid

fig:

%t for diplaying plot

B:

matrix with configuration of the next generation

Description

conway computes the configuration of the next generation of a grid of square cells, each of which is in either live or dead. Each cell will be live or dead in the next generation according to the rules of the Conway's game of life: 1) A live cells with exactly 2 or 3 live neighbors stays a live cell, otherwise it dies. 2) A dead cell with 3 live neighbors becomes alive, otherwise is stays dead. By default, the grid is assumed to be finite. If cyc=%t is given, then grid is assumed to be infinite and periodic. By default, no plot is shown. If fig=%t is given, then a figure with two subplots is shown, the first subplot being the configuration of the original grid and the second subplot being the configuration of the next generations. conway is a main function of the game_of_life package for Scilab.

Examples

// Compute the next generation
// of a spaceship glider pattern
// in a 10 by 10 cells grid and
// visualize the grids on plots.
//
A=genzero(10,10,'glider');..
B=conway(A,%t,%t);

See also

Authors


Report an issue
<< concat Game of Life of Conway evolution >>