"""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: int = 0 x_coordinate: int y_coordinate: int health: int def __init__(self, x_coordinate: int, y_coordinate: int) -> None: self.x_coordinate = x_coordinate self.y_coordinate = y_coordinate self.health = 3 Alien.total_aliens_created += 1 def hit(self): self.health -= 1 def is_alive(self) -> bool: return self.health > 0 def teleport(self, new_x_coordinate: int, new_y_coordinate: int): self.x_coordinate = new_x_coordinate self.y_coordinate = new_y_coordinate def collision_detection(self, other): pass pass # TODO: create the new_aliens_collection() function below to call your Alien class with a list of coordinates. def new_aliens_collection(list_positions: list[tuple[int, int]]) -> list[Alien]: list_of_aliens: list[Alien] = [] for alien_position_x, alien_position_y in list_positions: list_of_aliens.append(Alien(alien_position_x, alien_position_y)) return list_of_aliens