neuropercolation/src/cellular_automaton/ca_cell.py

26 lines
645 B
Python
Raw Normal View History

2018-12-01 19:37:18 +00:00
class Cell:
2018-12-02 16:45:08 +00:00
def __init__(self, name: str, coordinate: list):
2018-12-01 19:37:18 +00:00
self.name = name
2018-12-02 16:45:08 +00:00
self.coordinate = coordinate
2018-12-01 19:37:18 +00:00
self.neighbours = []
2018-12-09 10:20:16 +00:00
self.state = None
self._dirty = False
2018-12-01 14:14:22 +00:00
2018-12-01 19:37:18 +00:00
def set_neighbours(self, neighbours: list):
2018-12-08 21:33:13 +00:00
""" Set new cells as neighbour of this cell.
:param neighbours: A List of Cell names.
"""
2018-12-01 19:37:18 +00:00
self.neighbours = neighbours
2018-12-02 16:45:08 +00:00
2018-12-08 21:33:13 +00:00
def is_set_for_redrawing(self):
return self._dirty
2018-12-08 21:33:13 +00:00
def set_for_redraw(self):
self._dirty = True
2018-12-08 21:33:13 +00:00
def release_from_redraw(self):
self._dirty = False
2018-12-09 14:25:12 +00:00
def __str__(self):
return self.name