How would you store a large 2D game grid internally that requires frequent access to nearest neighbors?
Imagine you have a class Square in C++, which represents a square on the board. Two options are readily apparent for storage, assuming the grid itself is dense: