问题描述:

All I want to do is create a maze which is nothing but a n*n square with goal state (one cell), blocked cells and a start cell. I then plan to apply DFS and BFS on the maze to find a path from start state to goal state. I am stuck as to what data structure should I use for representing my maze?? Any suggestions??.

网友答案:

If that's the exact way that you want to represent it, then use a 2D array (an array within an array) of numbers. Then, the number zero means something is open, the number one means something is blocked, and two is your goal.

相关阅读:
Top