From ee4da2417d5144ab8b4c4756749a04db515079a8 Mon Sep 17 00:00:00 2001 From: Benjamin Adovasio Date: Mon, 30 Mar 2026 09:12:30 -0400 Subject: [PATCH] Finished step 2 --- Project 5/TurtleMaze.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/Project 5/TurtleMaze.py b/Project 5/TurtleMaze.py index 4f312fb..67ef915 100644 --- a/Project 5/TurtleMaze.py +++ b/Project 5/TurtleMaze.py @@ -235,16 +235,27 @@ class TurtleMaze: def main(): - maze = TurtleMaze('maze_3.txt') + maze = TurtleMaze('maze_2.txt') maze.drawMaze() - # print("row at index 4", maze[4]) - # print("cell at index 4, 4", maze[4][4]) + # print the contents of the top-right corner + top_right = maze[0][len(maze[0]) - 1] + print("Top-right corner:", top_right) + + # print the start and goal cells + print("Start cell:", maze.getStart()) + print("Goal cell:", maze.getGoal()) + + # start at S maze.updatePosition(maze.getStart()) - print(maze.getStart()) + + # move only to neighboring cells so the turtle stays on the path + maze.updatePosition(maze[9][15], Contents.TRIED) # down 1 + maze.updatePosition(maze[9][16], Contents.PART_OF_PATH) # right 1 + maze.updatePosition(maze[9][17], Contents.PART_OF_PATH) # right 1 + maze.updatePosition(maze[8][17], Contents.DEAD_END) # up 1 maze.t.screen.mainloop() - if __name__ == "__main__": main() \ No newline at end of file