I read from a comment on this forum that advised a fellow new programmer to be sure that whatever objects move on the map do not move beyond the boundaries. Otherwise, the program would crash. When making a similar map, I made a Boolean field to avoid this situation but forgot to link initializers for the "walls" of the map.
Then when I tested out the map by manually moving an object around, I moved past a wall and beyond. Since the map boundaries are the same as the length of the array where the map is stored, I expected my program to abort. Instead, I discovered that there was an extra column/row past the "wall." Furthermore, by moving another step away from the "wall," I ended appearing on the other side of the map like in the game Asteroids. This worked with both vertical and horizontal "walls."
There is nothing in my code that suggests this should happen, and the instructions for moving my objects are simply position++ and position--. Does anyone know how this occurred?