I am trying to find the most efficient way to traverse all adjacent cells in a grid.
For example let's say I have a 2D Array represented as:
vector <Item> grid;
and I have a point within this grid (represented by the blue cell):
grid[x][y];
and I want it to traverse all the adjacent coordinates.
So for example if my point was (1,1) it would be able to traverse (0,0) (0,1) (0,2) (1,0) (1,2) (2,0) (2,1) (2,2) which are the 8 points which surround it (excluding the case for now when (x,y) is in a corner or at the edge of the grid).
What is the best way to do this in C++? my initial thought was to do Breadth-First Search, any thoughts?
