Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
maze solution
#4
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.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
maze solution - by jenya56 - Mar-27-2019, 04:03 PM
RE: maze solution - by perfringo - Mar-27-2019, 04:37 PM
RE: maze solution - by jenya56 - Mar-27-2019, 04:46 PM
RE: maze solution - by ichabod801 - Mar-27-2019, 04:47 PM
RE: maze solution - by jenya56 - Mar-27-2019, 04:51 PM
RE: maze solution - by ichabod801 - Mar-27-2019, 05:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  problem about maze path finder Simurg 2 2,038 Aug-16-2020, 01:10 PM
Last Post: Simurg
  Maze Mapping with Image Processing furkankuyumcu 0 2,247 Dec-16-2018, 02:45 PM
Last Post: furkankuyumcu
  Understanding maze generation code kleynah22 1 3,328 Nov-11-2017, 02:09 PM
Last Post: sparkz_alot
  maze pattern angelbest4 1 2,781 Sep-03-2017, 12:09 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020