I was able to solve all my bugs to get my code to look EXACTLY how i wanted to.

I used AI to help me through some issues, but all the coding I understood and worked through and typed on my own
I learned a lot about the structure and when AI would suggest something I could be like thats now going to solve my issue I need to do this which felt very motivating
This commit is contained in:
mollychi
2025-12-14 12:47:15 -05:00
parent b2dd17e4ad
commit 621a680676
4 changed files with 37 additions and 18 deletions

22
frog.py
View File

@@ -8,16 +8,18 @@ class Frog:
def handle_keystroke(self, keystroke, game):
x, y = self.position
if keystroke.name in ("KEY_LEFT", "KEY_RIGHT", "KEY_UP"):
if keystroke.name in ("KEY_LEFT", "KEY_RIGHT"):
if keystroke.name == "KEY_LEFT":
new_position = (x - 1, y)
if keystroke.name == "KEY_RIGHT":
elif keystroke.name == "KEY_RIGHT":
new_position = (x + 1, y)
if keystroke.name == "KEY_UP":
froggy = game.get_agent_by_name('froggy')
froggy.position = (froggy.position[0], froggy.position[1]+1)
if game.on_board(new_position):
if game.is_empty(new_position):
self.position = new_position
else:
game.end()
else:
return
if not game.on_board(new_position):
return
if not game.is_empty(new_position):
game.end()
self.position = new_position