-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRules.py
More file actions
45 lines (29 loc) · 809 Bytes
/
Rules.py
File metadata and controls
45 lines (29 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
'''
* Rules.py
*
* Created on: 25.12.2018
* Author: Andrew Jason Bishop
*
* General description:
* xxx
'''
class Rules:
def __init__(self, _lifeCycler):
self.lifeCycler = _lifeCycler
def liveCellRules(self, _lifeNeighborCount):
# Conway Rules 2&4
if (2 > _lifeNeighborCount or 3 < _lifeNeighborCount):
return self.lifeCycler.cellDeath
# Conway Rule 3
else:
return None
def deadCellRules(self, _lifeNeighborCount):
# Conway Rule 1
if 3 == _lifeNeighborCount:
return self.lifeCycler.cellBirth
# free memory
elif 0 == _lifeNeighborCount :
return self.lifeCycler.cellTermination
else:
return None
''' END '''