I have a 2D array of squares that make up a 50 x 50 grid. The top left square has a position of (0,0) and the bottom right has a position of (49,49). I'm creating a computer player and need help trying to efficiently check what the positions of the surrounding squares are (for the AI). For example, if the user is at position (x,y), how can I find out what the positions of the squares are north, south, east and west of it? (I don't need the diagonal positions). Thank you.