Пример #1
0
        public void createPigeon()
        {
            i++;
            Pigeon p1 = new Pigeon("p" + i);

            listp.Add(p1);

            while (true)
            {
                Thread.Sleep(App.env.vitesse);
                p1.Avance1Tour(p1.X, p1.Y);
            }
        }
Пример #2
0
        private static Nourriture closest(Pigeon p1, List <Nourriture> listn)
        {
            Nourriture closest  = null;
            double     minDist2 = double.MaxValue;

            foreach (Nourriture n in listn)
            {
                double dist2 = Distance2(p1, n);
                if (dist2 < minDist2)
                {
                    minDist2 = dist2;
                    closest  = n;
                }
            }
            return(closest);
        }
Пример #3
0
 public void remove(Pigeon p)
 {
     listp.Remove(p);
 }
Пример #4
0
 public void add(Pigeon p)
 {
     listp.Add(p);
 }
Пример #5
0
 public abstract void Deplacement(int dimX, int dimY, Pigeon unPerso);
Пример #6
0
 private static double Distance2Human(Pigeon p1, Human n2)
 {
     return(Pow2(n2.X - p1.X) + Pow2(n2.Y - p1.Y));
 }
Пример #7
0
 private static double Distance2(Pigeon p1, Nourriture n2)
 {
     return(Pow2(n2.X - p1.X) + Pow2(n2.Y - p1.Y));
 }