Exemple #1
0
 def test_will_not_survive_underpopulation(self):
     cell = Cell(ALIVE)
     neighbours = [1, 0, 0, 0, 0, 0, 0]
     self.assertFalse(cell.will_survive(neighbours))
Exemple #2
0
 def test_will_not_be_born(self):
     cell = Cell(DEAD)
     neighbours = [1, 1, 0, 0, 0, 0, 0,]
     self.assertFalse(cell.will_survive(neighbours))
     neighbours = [1, 1, 1, 1, 0, 0, 0]
     self.assertFalse(cell.will_survive(neighbours))
Exemple #3
0
 def test_stay_alive(self):
     cell = Cell(ALIVE)
     neighbours2 = [1, 1, 0, 0, 0, 0, None, None]
     self.assertTrue(cell.will_survive(neighbours2))
     neighbours3 = [1, 1, 1, 0, 0, 0, None, None]
     self.assertTrue(cell.will_survive(neighbours3))
Exemple #4
0
 def test_create_life(self):
     cell = Cell(DEAD)
     neighbours = [1, 1, 1, 0, 0, 0, 0, None, None]
     self.assertTrue(cell.will_survive(neighbours))