neuropercolation/src/cellular_automaton/ca_rule.py

18 lines
607 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
2019-02-16 17:05:26 +00:00
def evolve_cell(last_cell_state, neighbors_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.
2019-02-16 17:05:26 +00:00
:param neighbors_last_states: The cells neighbors current states.
2018-12-02 16:45:08 +00:00
:return: True if state changed, False if not.
2019-02-16 17:05:26 +00:00
A cells evolution will only be called if it or at least one of its neighbors has changed last evolution_step cycle.
2018-12-02 16:45:08 +00:00
"""
return False