neuropercolation/cellular_automaton/rule.py
2019-02-17 11:11:27 +01:00

18 lines
591 B
Python

from abc import abstractmethod
class Rule:
def __init__(self):
pass
@staticmethod
@abstractmethod
def evolve_cell(last_cell_state, neighbors_last_states):
""" Calculates and sets new state of 'cell'.
:param last_cell_state: The cells current state to calculate new state for.
:param neighbors_last_states: The cells neighbors current states.
:return: New state.
A cells evolution will only be called if it or at least one of its neighbors has changed last evolution_step cycle.
"""
return last_cell_state