pythondata-structuresmaze

Represent Maze in Python


How could I represent the following maze in Python?

I would like to make a program that navigates it so that it goes from Start to End, while also going to every Gate before it reaches End.

I am not very familiar with data structures, so all help is appreciated!

Maze


Solution

  • I think you want a 2d array of nodes. Some would suggest using Numpy. A node object could have a type property (normal,start,end,gate) and some way to represent exits (North,South,East,West). For discovering all gates you would need to ensure all nodes were checked. Maybe this strategy would help.