Maps should not have hard borders, bu rather be folded in toroid. Calculating distance becomes a bit tricky since the units on opposite sides of the map should actually be close together.