-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameOfLife.py
More file actions
78 lines (53 loc) · 1.62 KB
/
GameOfLife.py
File metadata and controls
78 lines (53 loc) · 1.62 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
'''
* GameOfLife.py
*
* Created on: 10.11.2018
* Author: Andrew Jason Bishop
*
* General description:
* xxx
'''
import Universe as un
import ClusterSpace as cs
import SpaceCluster as sc
import LifeCycler as lc
import EnvirCreator as ec
import EnvirEvaluator as ee
import Rules as rl
import CellFactory as cf
import Reality as rt
import Patterns as pt
from Enums import *
#import matplotlib.pyplot as plt
USE_CLUSTER_SPACE = True
def init_with_pattern(_pattern):
print("Initial live cells:")
for cell in _pattern:
myEnvirCreator.create_initial_LiveCell( cell )
print( cell)
def wireUp():
myLifeCycler.setCellFactory( myCellFactory )
myLifeCycler.setCreator( myEnvirCreator )
myEnvirCreator.setCellFactory( myCellFactory )
myEnvirCreator.setLifeCycler( myLifeCycler )
myEnvirCreator.setEvaluator( myEnvirEvaluator )
print("wired up")
if __name__ == '__main__':
if USE_CLUSTER_SPACE:
mySpace = cs.ClusterSpace()
else:
mySpace = sc.SpaceCluster()
myLifeCycler = lc.LifeCycler(mySpace)
myEnvirCreator = ec.EnvirCreator(mySpace)
myEnvirEvaluator = ee.EnvirEvaluator(mySpace)
myRules = rl.Rules(myLifeCycler)
myCellFactory = cf.CellFactory(myEnvirEvaluator, myRules)
wireUp()
myUniverse = un.Universe( mySpace )
myReality = rt.Reality( myUniverse,
myEnvirCreator,
myEnvirEvaluator )
init_with_pattern( pt.glider )
myReality.runState()
#myReality.editState()
''' END '''