seagull/rules.py
def life_rule(X: np.ndarray, rulestring: str) -> np.ndarray:
    """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
    -------
    np.ndarray
        Updated board after applying the rule
    """
    birth_req, survival_req = _parse_rulestring(rulestring)
    neighbors = _count_neighbors(X)
    birth_rule = (X == 0) & (np.isin(neighbors, birth_req))
    survival_rule = (X == 1) & (np.isin(neighbors, survival_req))
    return birth_rule | survival_rule
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
    -------
    np.ndarray
        Updated board after applying the rule
    
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

np.ndarray
Updated board after applying the rule
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 np . ndarray Updated board after applying the rule
def life_rule(X: np.ndarray, rulestring: str) -> np.ndarray:
    birth_req, survival_req = _parse_rulestring(rulestring)
    neighbors = _count_neighbors(X)
    birth_rule = (X == 0) & (np.isin(neighbors, birth_req))
    survival_rule = (X == 1) & (np.isin(neighbors, survival_req))
    return birth_rule | survival_rule
def life_rule ( X : np . ndarray , rulestring : str ) -> np . ndarray : birth_req , survival_req = _parse_rulestring ( rulestring ) neighbors = _count_neighbors ( X ) birth_rule = ( X == 0 ) & ( np . isin ( neighbors , birth_req ) ) survival_rule = ( X == 1 ) & ( np . isin ( neighbors , survival_req ) ) return birth_rule | survival_rule
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.
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 .
"""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
    -------
    np.ndarray
        Updated board after applying the rule
    """
X
np.ndarray
rulestring
str