I fixed it so it worked

This commit is contained in:
lfitchlee
2025-11-19 09:39:01 -05:00
parent 8f8ca76614
commit 62327dd5ea
7 changed files with 70 additions and 0 deletions

View File

@@ -2,3 +2,23 @@
# ------------
# By MWC Contributors
# This module defines an asteroid agent class.
class Asteroid:
character = 'O'
def __init__(self, position):
self.position = position
def play_turn(self, game):
if game.turn_number % 2 == 0:
x, y = self.position
if y == HEIGHT - 1:
game.remove_agent(self)
else:
ship = game.get_agent_by_name('ship')
new_position = (x, y + 1)
if new_position == ship.position:
game.end()
else:
self.position = new_position
HEIGHT = 25