Ejemplo n.º 1
0
        // Generate tasklist from a node list
        public Queue <string> generatetasklist(List <Modelisation.Node> l)
        {
            Queue <string> tasklist = new Queue <string>();

            if (l.Count != 0)
            {
                Modelisation.Node node = l[l.Count - 1];

                // While the node is not the root node, we add its lastaction to the tasklist
                while (node.getLastAction() != "nothing")
                {
                    tasklist.Enqueue(node.getLastAction());
                    node = node.getParent();
                }

                //tasklist.Enqueue(node.getLastAction());
            }

            return(tasklist);
        }
        private Queue <string> generateTasklist(Modelisation.Node ns, Modelisation.Node ng)
        {
            List <string> actions = new List <string>();

            while (ns.getLastAction() != "root")
            {
                actions.Insert(0, ns.getLastAction());
                ns = ns.getParent();
            }

            while (ng.getLastAction() != "goal")
            {
                actions.Add(ng.getLastAction());
                ng = ng.getParent();
            }


            Queue <string> queue = new Queue <string>(actions);

            return(queue);
        }