Beispiel #1
0
 def test_dead_cell_is_dead_next_gen_if_gt_fertile_neighbor_count(self):
     cell = Cell(alive=False)
     gt_fertile_count = Cell.FERTILE_NEIGHBOR_COUNT + 1
     is_alive_next_gen = cell.is_alive_next_generation(gt_fertile_count)
     self.assertFalse(is_alive_next_gen)
Beispiel #2
0
 def test_dead_cell_in_fertile_neighboorhood_is_alive_next_generation(self):
     cell = Cell(alive=False)
     is_alive_next_generation = cell.is_alive_next_generation(
         Cell.FERTILE_NEIGHBOR_COUNT)
     self.assertTrue(is_alive_next_generation)
Beispiel #3
0
 def test_cell_is_dead_next_generation_if_lt_stable_count(self):
     cell = Cell()
     min_stable = Cell.STABLE_NEIGHBOR_RANGE[0]
     is_alive_next_gen = cell.is_alive_next_generation(min_stable - 1)
     self.assertFalse(is_alive_next_gen)
Beispiel #4
0
 def test_cell_is_dead_from_overcrowding_next_gen_if_gt_stable_count(self):
     cell = Cell()
     max_stable = Cell.STABLE_NEIGHBOR_RANGE[-1]
     is_alive_next_gen = cell.is_alive_next_generation(max_stable + 1)
     self.assertFalse(is_alive_next_gen)
Beispiel #5
0
 def test_cell_is_still_alive_next_gen_if_in_stable_neighborhood(self):
     for i in Cell.STABLE_NEIGHBOR_RANGE:
         with self.subTest(stable_neighbor_count=i):
             cell = Cell()
             cell.is_alive_next_generation(i)
             self.assertTrue(cell.is_alive_next_generation)