|
@@ -1,11 +1,12 @@
|
1
|
1
|
|
2
|
|
-from synergine2.simulation import Subject, SimulationMechanism, Simulation
|
|
2
|
+from synergine2.simulation import Subject, SimulationMechanism
|
3
|
3
|
from synergine2.simulation import SimulationBehaviour
|
4
|
4
|
from synergine2.simulation import Event
|
5
|
5
|
from synergine2.simulation import SubjectBehaviour
|
6
|
6
|
from synergine2.utils import ChunkManager
|
7
|
7
|
from synergine2.xyz import ProximitySubjectMechanism, ProximityMixin
|
8
|
8
|
from synergine2.xyz import XYZSubjectMixin
|
|
9
|
+from synergine2.xyz import XYZSimulation
|
9
|
10
|
from synergine2.xyz_utils import get_around_positions_of_positions, get_min_and_max
|
10
|
11
|
|
11
|
12
|
COLLECTION_CELL = 'COLLECTION_CELL'
|
|
@@ -74,6 +75,7 @@ class CellDieBehaviour(SubjectBehaviour):
|
74
|
75
|
|
75
|
76
|
def action(self, data):
|
76
|
77
|
new_empty = Empty(
|
|
78
|
+ config=self.config,
|
77
|
79
|
simulation=self.simulation,
|
78
|
80
|
position=self.subject.position,
|
79
|
81
|
)
|
|
@@ -93,6 +95,7 @@ class CellBornBehaviour(SubjectBehaviour):
|
93
|
95
|
|
94
|
96
|
def action(self, data):
|
95
|
97
|
new_cell = Cell(
|
|
98
|
+ config=self.config,
|
96
|
99
|
simulation=self.simulation,
|
97
|
100
|
position=self.subject.position,
|
98
|
101
|
)
|
|
@@ -101,6 +104,7 @@ class CellBornBehaviour(SubjectBehaviour):
|
101
|
104
|
for position in positions_to_complete:
|
102
|
105
|
if position not in self.simulation.subjects.xyz:
|
103
|
106
|
new_empty = Empty(
|
|
107
|
+ config=self.config,
|
104
|
108
|
simulation=self.simulation,
|
105
|
109
|
position=position,
|
106
|
110
|
)
|
|
@@ -122,6 +126,7 @@ class InvertCellStateBehaviour(SimulationBehaviour):
|
122
|
126
|
|
123
|
127
|
if not cell_at_position or isinstance(cell_at_position, Empty):
|
124
|
128
|
new_cell = Cell(
|
|
129
|
+ config=self.config,
|
125
|
130
|
simulation=self.simulation,
|
126
|
131
|
position=position,
|
127
|
132
|
)
|
|
@@ -131,6 +136,7 @@ class InvertCellStateBehaviour(SimulationBehaviour):
|
131
|
136
|
return [CellBornEvent(new_cell.id)]
|
132
|
137
|
|
133
|
138
|
new_empty = Empty(
|
|
139
|
+ config=self.config,
|
134
|
140
|
simulation=self.simulation,
|
135
|
141
|
position=position,
|
136
|
142
|
)
|
|
@@ -178,5 +184,5 @@ class Empty(XYZSubjectMixin, Subject):
|
178
|
184
|
behaviours_classes = [CellBornBehaviour]
|
179
|
185
|
|
180
|
186
|
|
181
|
|
-class LifeGame(Simulation):
|
|
187
|
+class LifeGame(XYZSimulation):
|
182
|
188
|
behaviours_classes = [LotOfCellsSignalBehaviour]
|