neuropercolation/src/cellular_automaton/ca_rule.py

18 lines
606 B
Python

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