def test_play_next_turn(self):
        """
        This method tests that the Controller can correctly play one turn of the Game of Life. The expected result of
        this test is for the next turn of the Game of Life to be correctly played.
        """
        golc = GameOfLifeController()
        golc.set_up_game(create_initial_input())
        golc.play_next_turn()

        # Assert first that the turn count has been increased to 1.
        assert golc.get_game().get_turn_count() == 1

        # Write a simulation grid object to test the next generation in our given test.
        next_gen = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [1, 0, 1, 1, 1, 1, 1, 1, 1, 1],
                    [0, 1, 1, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
                    [1, 1, 1, 1, 1, 0, 1, 1, 1, 1],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

        # Test that it matches the calculated pattern.
        for x, row in enumerate(next_gen):
            # For each row in a cell
            for y, _col in enumerate(row):
                if next_gen[x][y] == 0:
                    # Assert that the cell at these 'coordinates' is dead.
                    assert golc.get_game().get_current_generation().get_cells()[x][y].get_state() == Dead()
                else:
                    # Assert that the cell at these 'coordinates' is alive.
                    assert golc.get_game().get_current_generation().get_cells()[x][y].get_state() == Alive()
    def test_play_next_turn(self):
        '''
        Tests a single turn of the Game of Life can be played.
        '''
        golc = GameOfLifeController()
        golc.set_up_game(create_initial_input())
        golc.play_next_turn()

        assert golc.get_game().get_turn_count() == 1

        # Write a simulation grid object to test the next generation in our
        # given test.
        next_gen = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [1, 0, 1, 1, 1, 1, 1, 1, 1, 1],
                    [0, 1, 1, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 1, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
                    [0, 0, 0, 1, 1, 1, 0, 0, 0, 0],
                    [1, 1, 1, 1, 1, 0, 1, 1, 1, 1],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
                    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

        # Test that it matches the calculated pattern.
        for x, row in enumerate(next_gen):
            for y, _col in enumerate(row):
                if next_gen[x][y] == 0:
                    assert golc.get_game().get_current_generation()\
                    .get_cells()[x][y].get_state() == Dead()
                else:
                    assert golc.get_game().get_current_generation()\
                    .get_cells()[x][y].get_state() == Alive()
    def test_get_turn_count(self):
        """
        This method tests the ability of the Controller to retrieve the number of turns that have been played so far.
        The expected result of this test is for the correct turn count to be retrieved at all times.
        """
        golc = GameOfLifeController()
        golc.set_up_game(create_initial_input())

        for i in range(0, 9):
            # For each turn, assert that the turn count is correct (starts at 0)
            assert golc.get_turn_count() == i
            golc.play_next_turn()