I have built a function that reads numbers from an array (that stores a map) to determine which directions the player may move. It was intended to scan the tiles one above, below, to the left of and to the right of the specified position (unless they don't exist, in which case it will skip them to avoid a segmentation fault).
My problem: I used an example map to test it out and the function should've printed "You can move: east and south.". It actually printed, "You can move: north and east. south.". My map is as follows ('2' is a placeholder for the player's position and would be '1' in the actual map):
10210
41110
01506
61038
04117
The player should not even be able to move north, seeing as they are at the top of the map anyway. They should only be able to move east and south.