예제 #1
0
        private static List <Node> RetracePath(Node startNode, Node currentNode)
        {
            List <Node> path = new List <Node>();

            do
            {
                path.Add(currentNode);
                currentNode = currentNode.parent;
                HandleAddToPath?.Invoke(currentNode);
            } while (currentNode != startNode);

            path.Reverse();
            return(path);
        }
예제 #2
0
        private static List <Node> RetracePath(Node startNode, Node currentNode)
        {
            List <Node> path = new List <Node>();

            do
            {
                path.Add(currentNode);
                currentNode = currentNode.Parent;
                HandleAddToPath?.Invoke(currentNode);                //visualization
            } while (currentNode != startNode);

            path.Add(startNode);
            return(path);
        }