I have a 10x11 array in my game. What is the best structure and way to store the connections between the elements of the array?
Some info about the connections:
- they are simple (2 elements are connected or not)
- an element can be connected with its 8 neighbours
- when I move from one position to another I need to add that connection
- when I'm in a position I need to check that element's connections
For example: "the player" is at [6,1]
- I need to check for all 8 directions if there is a connection there or not(this function returns a byte or int[8], doesn't matter)
- If the player wants to move to [6,2] I dont allow it
- If the player wants to move to [6,1] I allow it and store the new connection