Example #1
0
 /// <summary>
 /// 已经选择了某节点next后,将其在数据结构中进行安置。
 /// Open 必须为双向链表。
 /// Open2 是为了定位效率。
 /// </summary>
 /// <param name="next"></param>
 /// <param name="Open"></param>
 /// <param name="Open2"></param>
 /// <param name="Close"></param>
 public void Conduct(Node next, LinkedList<Node> Open, HashSet<Node> Open2, HashSet<Node> Close)
 {
     if (!Open2.Contains(next) && !Close.Contains(next))
     {
         Open.AddLast(next);
         Open2.Add(next);
         this.Children.Add(next);
         next.Parent = this;
     }
 }
Example #2
0
 public void Expand(LinkedList <Node >Open,HashSet <Node >Open2,HashSet <Node>Close)
 {
     Cell nullCell = this.p.NullCell;
     if( nullCell.upNei != null)
     {
         Node newNode = new Node(this.p ,new Action (nullCell,nullCell.upNei ));
         this.Conduct(newNode, Open, Open2, Close);
     }
     if (nullCell.downNei != null)
     {
         Node newNode = new Node(this.p, new Action(nullCell, nullCell.downNei));
         this.Conduct(newNode, Open, Open2, Close);
     }
     if (nullCell.leftNei != null)
     {
         Node newNode = new Node(this.p, new Action(nullCell, nullCell.leftNei));
         this.Conduct(newNode, Open, Open2, Close);
     }
     if (nullCell.rightNei != null)
     {
         Node newNode = new Node(this.p, new Action(nullCell, nullCell.rightNei));
         this.Conduct(newNode, Open, Open2, Close);
     }
 }