MCPcopy Create free account
hub / github.com/ActiveState/code / Run

Method Run

recipes/Python/578808_Python_Game_of_Life/recipe-578808.py:143–156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

141 col = 0
142
143 def Run(self):
144 self.population = 0
145 for cell in self.cells:
146 if cell.alive:
147 self.population += 1
148 if len(cell.a_neighbors) < 2:
149 cell.die()
150 elif len(cell.a_neighbors) > 3:
151 cell.die()
152 elif len(cell.a_neighbors) == 2 or len(cell.a_neighbors) == 3:
153 cell.live()
154 else:
155 if len(cell.a_neighbors) == 3:
156 cell.live()
157
158 def blitDirections(self):
159 text = self.font.render("Press Enter to begin, and Space to stop and clear board", 1, (255,255,255))

Callers 4

TickMethod · 0.95
recipe-65108.pyFile · 0.45
RunModulesMethod · 0.45
recipe-65107.pyFile · 0.45

Calls 2

liveMethod · 0.80
dieMethod · 0.45

Tested by

no test coverage detected