Mapping : code more generic

A new function for a code which was the same at several places. Some
values replace by their corresponding 'define'.
Also a function to find the coordinates of the square at a certain
cardinal point (useful for is_visited_at_direction for example, which by
the way returned for now the value for the current cell, not the cell in
the given direction).