Rules and Utilities¶
Rules¶
Rules determine how the evolution of the lifeforms will progress. In Seagull, rules are implemented as a function that takes in a 2dimensional array of a given shape then returns the updated array with the rule applied

seagull.rules.
conway_classic
(X)[source]¶ The classic Conway’s Rule for Game of Life (B3/S23)
 Return type

seagull.rules.
life_rule
(X, rulestring)[source]¶ A generalized life rule that accepts a rulestring in B/S notation
Rulestrings are commonly expressed in the B/S notation where B (birth) is a list of all numbers of live neighbors that cause a dead cell to come alive, and S (survival) is a list of all the numbers of live neighbors that cause a live cell to remain alive.
 Parameters
X (np.ndarray) – The input board matrix
rulestring (str) – The rulestring in B/S notation
 Returns
Updated board after applying the rule
 Return type
np.ndarray
Utilities¶
This module contains various utility functions to help with processing
Statistics¶
Statistics contain various computations to characterize a board state

seagull.utils.statistics.
cell_coverage
(state)[source]¶ Compute for the live cell coverage for the whole board
 Parameters
state (
numpy.ndarray
) – The board state to compute statistics from Returns
Cell coverage
 Return type

seagull.utils.statistics.
shannon_entropy
(state)[source]¶ Compute for the shannon entropy for the whole board
 Parameters
state (
numpy.ndarray
) – The board state to compute statistics from Returns
Shannon entropy
 Return type