def test_from_string_alive_column(self):
     state = from_string(2, 3, "..*...")
     self.assertTrue(state.is_alive(0, 2))
 def test_from_string_size(self):
     state = from_string(2, 3, "......")
     self.assertEqual((2, 3), state.get_dimensions())
Пример #3
0
 def test_neighbours_self(self):
     state = from_string(3, 3, "*********")
     count = state.count_alive_neighbours(1, 1)
     self.assertEqual(8, count)
 def test_from_string_alive_row(self):
     state = from_string(3, 2, "..*...")
     self.assertTrue(state.is_alive(1, 0))
Пример #5
0
 def test_neighbours_middle(self):
     state = from_string(3, 3, "*.*..*.*.")
     count = state.count_alive_neighbours(1, 1)
     self.assertEqual(4, count)
Пример #6
0
 def test_neighbours_corner(self):
     state = from_string(3, 3, ".*.*.....")
     count = state.count_alive_neighbours(0, 0)
     self.assertEqual(2, count)
Пример #7
0
    def test_dying_alone(self):
        state = from_string(1, 3, ".*.")
        next_state = next_generation(state)

        self.assertFalse(next_state.is_alive(0, 1))
Пример #8
0
 def test_neighbours_empty(self):
     state = from_string(3, 3, ".........")
     count = state.count_alive_neighbours(1, 1)
     self.assertEqual(0, count)
Пример #9
0
    def test_ressurrect_3(self):
        state = from_string(2, 3, ".*.*.*")
        next_state = next_generation(state)

        self.assertTrue(next_state.is_alive(1, 1))
Пример #10
0
    def test_not_ressurrect_2(self):
        state = from_string(2, 3, "...*.*")
        next_state = next_generation(state)

        self.assertFalse(next_state.is_alive(1, 1))
Пример #11
0
    def test_dying_5(self):
        state = from_string(2, 3, "******")
        next_state = next_generation(state)

        self.assertFalse(next_state.is_alive(1, 1))
Пример #12
0
    def test_not_dying_3_variation(self):
        state = from_string(2, 3, ".*.***")
        next_state = next_generation(state)

        self.assertTrue(next_state.is_alive(1, 1))
Пример #13
0
    def test_not_dying_3(self):
        state = from_string(2, 3, "***.*.")
        next_state = next_generation(state)

        self.assertTrue(next_state.is_alive(0, 1))