neuropercolation/src/cellular_automaton/ca_rule.py

18 lines
606 B
Python
Raw Normal View History

2018-12-02 16:45:08 +00:00
from abc import abstractmethod
2018-12-01 14:14:22 +00:00
2018-12-01 19:37:18 +00:00
class Rule:
def __init__(self):
pass
2019-01-31 12:38:48 +00:00
@staticmethod
2018-12-02 16:45:08 +00:00
@abstractmethod
def evolve_cell(last_cell_state, neighbours_last_states):
2018-12-02 16:45:08 +00:00
""" Calculates and sets new state of 'cell'.
2019-01-31 12:38:48 +00:00
:param last_cell_state: The cells current state to calculate new state for.
:param neighbours_last_states: The cells neighbours current states.
2018-12-02 16:45:08 +00:00
: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