Mar-27-2019, 04:47 PM
Being more specific about the problem would have been helpful (as in the full text of the error message).
I get an index error in getAdjacentSquares. When you add squares, you are not checking to see if the added squares are actually in the maze. So it starts at the 's', goes to the right, and causes an error. Either you need to specify that all of your mazes have walls around the borders, which would seem odd, or you need to check each square with a conditional before entering it. Horizontal coordinates need to be 0 <= coordinate < len(maze[0], and vertical coordinates need to be 0 <= coordinate <= len(maze). Note that you will need four conditionals, one for each square added.
I get an index error in getAdjacentSquares. When you add squares, you are not checking to see if the added squares are actually in the maze. So it starts at the 's', goes to the right, and causes an error. Either you need to specify that all of your mazes have walls around the borders, which would seem odd, or you need to check each square with a conditional before entering it. Horizontal coordinates need to be 0 <= coordinate < len(maze[0], and vertical coordinates need to be 0 <= coordinate <= len(maze). Note that you will need four conditionals, one for each square added.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures