I am going to try my hat at programming a game. My game will need to run the A* path finding algorithm on a traditional game grid.
Like this for example: (S=Start, G=Goal, X=Wall)
-------------------------------
| | | | | | | | | G| |
-------------------------------
| | | | | | | | | | |
-------------------------------
| | X| X| X| X| | | | | |
-------------------------------
| | | | | X| | | | | |
-------------------------------
| S| | | | | | | | | |
-------------------------------
To implement A*, I will need to be able to get the “neighbors” of any node. (For Example, Start has 3 neighbors (Above, Diagonal, and Right).)
The ways that come to mind to map this at a data layer is a 2 dimensional array or a linked list.
The array seems like the most performant and easy to pull off. So if S was [0][4], then its neighbors would be [0 + 1][4] (Right), [0][4 - 1] (Above), [0 + 1][4 - 1] (Diagonal)
But having done .NET application development for a few years, basic arrays seem a bit old school to me.
So before I go down that road, I thought I would ask if there is a nice .NET collection type I can use to map out a grid (at the data layer, not the UI).
Arrays sounds like the right choice in this case. Remember that most of the data structures provided are attempting to provide different functionality.
Given that the only abstract method you need (neighbors) is a quick implementation, there is no reason to use anything more complex as your basis.