コード例 #1
0
 def test_survival_from_wellpopulated_neighbourhood(self):
     universe = Universe(5, 5)
     subjectCell = Cell(2, 2)
     lives = [Cell(1, 1), Cell(3, 1), subjectCell, Cell(3, 3)]
     universe.seed(lives)
     next_gen_lives = universe.evolve().lives
     assert subjectCell in next_gen_lives
コード例 #2
0
 def test_rebirth_of_dead_cell_from_reproducable_population(self):
     universe = Universe(5, 5)
     subjectCell = Cell(2, 2)
     lives = [Cell(1, 1), Cell(3, 1), Cell(3, 3)]
     universe.seed(lives)
     next_gen_lives = universe.evolve().lives
     assert subjectCell in next_gen_lives
コード例 #3
0
 def test_death_from_underpopulated_neighbourhood(self):
     universe = Universe(5, 5)
     lives = [Cell(2, 2)]
     universe.seed(lives)
     actual = universe.evolve().lives
     expected = []
     assert actual == expected