Пример #1
0
    def test_kill_cells(self):

        colony = Cells(0)
        colony.choose_cells([[0, 0, 0], [0, 1, 0], [0, 0, 0]])
        colony.kill_cells()
        expected = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]])
        actual = colony.get_array()
        self.assertTrue((expected == actual).all())
Пример #2
0
    def test_update_cells_basic(self):

        colony = Cells(50)
        colony.kill_cells()
        expected = np.zeros((50, 50))
        colony.live_or_die()
        actual = colony.get_array()
        self.assertTrue((expected == actual).all())

        colony.choose_cells([[1, 1], [0, 0]])
        colony.live_or_die()
        actual = colony.get_array()
        expected = np.array([[0, 0], [0, 0]])
        self.assertTrue((expected == actual).all())

        colony.choose_cells([[1, 1, 1], [1, 1, 1], [1, 1, 1]])
        colony.live_or_die()
        actual = colony.get_array()
        expected = np.array([[1, 0, 1], [0, 0, 0], [1, 0, 1]])
        self.assertTrue((expected == actual).all())