An generic implementation of A* algorithm for path-finding