Beispiel #1
0
        /// <summary>
        /// Adds the RRA* algorithm nodes.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="StartNode">The start node.</param>
        public void addPath(Path path, int StartNode)
        {
            var currentNode    = StartNode;
            var firstAddedNode = true;

            //go through all hops
            while (Closed.Contains(currentNode) && currentNode != this.StartNode)
            { //rraStar StartNode = GoalNode of the Agent
                //get all the nodes to the next hop
                var nextHop = NextsNodesUntilTurn(currentNode);
                for (int i = 0; i < nextHop.Count; i++)
                {
                    //add node
                    path.AddLast(nextHop[i], i == nextHop.Count - 1, 0);

                    //the first node (n) is the connection node. Sometimes a stop at (n - 1) is not necessary
                    if (firstAddedNode && path.Count >= 3)
                    {
                        firstAddedNode = false;
                        path.DeleteStopIfPossible(_graph, path.Count - 2);
                    }
                }

                currentNode = nextHop[nextHop.Count - 1];
            }

            return;
        }
 public List <SpriteByte> RemainingBytes()
 {
     return(DATASET
            .Where(x => !Closed.Contains(x.Offset))
            .ToList());
 }