Ejemplo n.º 1
0
 public WayFinder(MovePoint start, int mov)
 {
     this.Start = start;
     this.Mov   = mov;
     _arrayList = new Dictionary <Point2D, MovePoint>(1 + 2 * mov * (mov + 1));
     //_arrayList.Add(start.Location,start);
 }
Ejemplo n.º 2
0
 public void Add(MovePoint mp)
 {
     if (this._arrayList.ContainsKey(mp.Location))
     {
         if (this._arrayList[mp.Location].CompareTo(mp) > 0)
         {
             this._arrayList[mp.Location] = mp;
         }
     }
     else
     {
         this._arrayList.Add(mp.Location, mp);
     }
 }
Ejemplo n.º 3
0
        public IEnumerable <MovePoint> RouteTo(Point2D p)
        {
            if (!_arrayList.ContainsKey(p))
            {
                return(null);
            }
            Stack <MovePoint> temp = new Stack <MovePoint>();
            MovePoint         mp   = _arrayList[p];

            temp.Push(mp);
            while (mp.Parent != null)
            {
                temp.Push(mp.Parent);
                mp = mp.Parent;
            }
            return(temp);
        }