Im proud im understanding what im doing

Im stuck on testing my code
Im worried my code isnt doing what i want it to but i cant test it to see
This commit is contained in:
mollychi
2025-12-05 19:50:01 -05:00
parent af69f8ce27
commit 4f3655867f
7 changed files with 67 additions and 0 deletions

19
obstacle.py Normal file
View File

@@ -0,0 +1,19 @@
class Obstacle:
character = 'O'
def __init__(self, position):
self.position = position
def play_turn(self, game):
width, height = game.board_size
if game.turn_number % 2 == 0:
x, y = self.position
if y == height + 1:
game.remove_agent(self)
else:
froggy = game.get_agent_by_name('froggy')
new_position = (x, y + 1)
if new_position == froggy.position:
game.end()
else:
self.position = new_position