Original Post
I'm trying to learn some pathfinding algorithms, and I'm having trouble converting my map to usable nodes in a tree. My map is very simple, a 2d matrix of 1s (walkable) and 0s (unwalkable), where the 'player' starts at a random starting point and finds the shortest path to a random goal by moving up, down, left, and right. In my mind, this sounds simple enough. Create a node from a the starting coordinate and put it in the open list; move it to the closed list and put its children in the open list, and repeat until the goal node is in the closed list and then move back up the tree to find the path. I may have not gotten exactly right, but I have the general gist of it. However, I'm not sure how to create the nodes and keep track of its children. Supposed 'square' [2][2] is my start. Of course, I know that its children are at [col +1], [col-1], [row + 1], and [row - 1], but how do I create a node from that information that will also know its children? I hope I'm making myself clear... I'm not really sure how to tackle this problem.