A* search for shortest path, avoiding walls