private char shortestSafePathToPoint(WumplusEnvironment we, Point point) {
        // initialize visited nodes list so that we don't revisited nodes we've already visited in this bfs.
        Hashtable<Point, Boolean> isExhausted = new Hashtable<Point, Boolean>();
        //	log.d("####################Path to Point " + point + " start A* search ####################################");
        for (int i = 0; i <= 11; i++) {
            for (int j = 0; j <= 11; j++) {
                isExhausted.put(new Point(j, i), false);
            }
        }

        // initialize other things

        PriorityQueue<PriorityCaveNode> pq = new PriorityQueue<PriorityCaveNode>();
        Hashtable<Point, CaveNode> grid = we.grid;

        PriorityCaveNode first = new PriorityCaveNode(grid.get(new Point(this.x, this.y)), 0, new Vector<Character>(), this.direction);
        pq.add(first);

        // A* Search

        while (!pq.isEmpty()) {
            //log.d("Entered A* Search");
            // initialize this step.

            PriorityCaveNode curPNode = pq.remove();
            CaveNode node = curPNode.node;
            char curDir = curPNode.directions.lastElement().charValue();
            int curCost = curPNode.cost;

            Point curPoint = new Point(node.x, node.y);

            // If we have reached a node that was not visited, then we'll return the direction taken to get to it!

            if (node.x == point.x && node.y == point.y) {
                try {
                    return curPNode.directions.get(1).charValue();
                } catch (Exception e) {
                    return 'I';
                }
            }

            // proceed if current node hasn't been visited in the bfs yet and it isn't a wall.

            if (!isExhausted.get(curPoint).booleanValue() && !node.hasObstacle) {
                char leftDir = getLeftDirection(curDir);
                char rightDir = getRightDirection(curDir);
                char backDir = getBackDirection(curDir);

                // attempt to travel in all directions. Account for cost of turning.

                aStarTravel(pq, we, curPNode, curDir, curCost, point);
                aStarTravel(pq, we, curPNode, leftDir, curCost + 1, point);
                aStarTravel(pq, we, curPNode, rightDir, curCost + 1, point);
                aStarTravel(pq, we, curPNode, backDir, curCost + 2, point);
            }
            isExhausted.put(curPoint, true);
        }

        return 'I'; // I for IDLE : it was not possible to safely reach an unvisited node
    }