Skip to content

Conversation

alexbird-hunterindustries

I recognize that community contributions are not being accepted, and expect this PR to be automatically closed (as the docs say it will be)

Until the pause on contributions ends, all PRs from the larger community will be automatically closed with a note.

I'm publishing it anyway so I have something to link to in the community thread


Before this change, you can pass the tests for new_aliens_collection by returning an empty list. After this change, the returned list must have the same length as the input list (so you create the same number of Aliens as the input asks for).

Here is a sample solution that passes all the tests (but incorrectly returns an empty list from the factory method)

"""Solution to Ellen's Alien Game exercise."""


class Alien:
    """Create an Alien object with location x_coordinate and y_coordinate.

    Attributes
    ----------
    (class)total_aliens_created: int
    x_coordinate: int - Position on the x-axis.
    y_coordinate: int - Position on the y-axis.
    health: int - Number of health points.

    Methods
    -------
    hit(): Decrement Alien health by one point.
    is_alive(): Return a boolean for if Alien is alive (if health is > 0).
    teleport(new_x_coordinate, new_y_coordinate): Move Alien object to new coordinates.
    collision_detection(other): Implementation TBD.
    """

    total_aliens_created = 0

    def __init__(self, x_coordinate, y_coordinate):
        Alien.total_aliens_created += 1
        self.x_coordinate = x_coordinate
        self.y_coordinate = y_coordinate
        self.health = 3

    def collision_detection(self, x):
        pass

    def hit(self):
        self.health -= 1

    def teleport(self, x, y):
        self.x_coordinate = x
        self.y_coordinate = y

    def is_alive(self):
        return self.health > 0

#TODO:  create the new_aliens_collection() function below to call your Alien class with a list of coordinates.

def new_aliens_collection(x):
    return []

I would have expected a test failure, but got none (all tests passing).

After this change, the above code causes one test to fail:

FAILED classes_test.py::ClassesTest::test_new_aliens_collection - AssertionError: 0 != 3 : Expected 3 Aliens, got 0

After this change, as expected, when the new_aliens_collection method is implemented, the tests pass

… the factory

Before this change, you can pass the tests for `new_aliens_collection`
by returning an empty list. After this change, the returned list must
have the same length as the input list (so you create the same number of
Aliens as the input asks for).
Copy link
Contributor

github-actions bot commented Oct 2, 2025

This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested.

If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

Copy link
Contributor

github-actions bot commented Oct 2, 2025

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant