示例#1
0
 // Set Childern
 public void New_Child(Nod child)
 {
     this.Childern.Add(child);
     if (Childern.Count > 1)
     {
         this.ReSort();
     }
 }
示例#2
0
        private List <Nod> Get_Track(Nod child)
        {
            List <Nod> Track = new List <Nod>();
            Nod        root  = child;

            while (root.Get_Parent() != null)
            {
                Track.Add(root);
                root = root.Get_Parent();
            }
            return(Track);
        }
示例#3
0
        private void UniformCostSearch(String data)
        {
            openL.Add(S);
            while (true)
            {
                if (openL[0].Get_Data() == data)
                {
                    closeQ.Enqueue(openL[0]);
                    MessageBox.Show("We found " + data);
                    foreach (Nod n in Get_Track(openL[0]))
                    {
                        MessageBox.Show(n.Get_Data());
                    }
                    openL.Clear();
                    break;
                }
                else
                {
                    closeQ.Enqueue(openL[0]);
                    openL.Remove(openL[0]);
                    foreach (Nod x in closeQ.Last().Get_Childern())
                    {
                        Step = x;
                        Step.Set_Distance(Step.Get_Distance() + closeQ.Last().Get_Distance());
                        openL.Add(Step);
                        ReSort();
                    }
                    //foreach (Nod n in openL)
                    //{
                    //    MessageBox.Show("List: " + n.Get_Data() + " - " + n.Get_Distance());
                    //}
                    //MessageBox.Show(openL[0].Get_Distance().ToString() + " - " + openL[0].Get_Data());

                    //  setControl(data);
                }
            }
            //foreach (Nod n in closeQ)
            //{
            //    MessageBox.Show(n.Get_Data());
            //}

            closeQ.Clear();
        }
示例#4
0
 // Set Parent
 public void Set_Parent(Nod parent)
 {
     this.Parent = parent;
 }