<< evolution Game of Life of Conway

Game of Life of Conway >> Game of Life of Conway > genzero

genzero

Generates a matrix of ones and zeros

Syntax

[A]=genzero(m,n,P)

Parameters

m:

number of lines

m:

number of columns

P:

probability for live cell or a grid pattern

A:

generated matrix

Description

genzero generates a matrix of ones and zeros of m lines and n columns. If probability for live cell if given, the values of individual cells are computed accordingly. If the grid pattern is assingned by strings 'block', 'glider', 'blinker', 'toad' or 'beacon' matrix is generated with the pattern at its superior left corner. genzero is a main function of the game_of_life package for Scilab.

Examples

// Generate a spaceship glider pattern
// in a 9 lines and 7 columns matrix.
//
A=genzero(9,7,'glider')

// Generate a 27 by 28 cells grid
// where individual cells have a 26:74 chance
// to be live or dead.
A=genzero(27,28,.26)

See also

Authors


Report an issue
<< evolution Game of Life of Conway