we didnt even write it a good 99% of it was copy and paste.

This commit is contained in:
cdonahue
2025-11-17 09:47:12 -05:00
parent ab49fda2bf
commit ac50df18d5
7 changed files with 65 additions and 16 deletions

View File

@@ -1,4 +1,18 @@
# asteroid.py
# ------------
# 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_by_name(self.name)
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