Esempio n. 1
0
 /// <summary>
 /// Predykat szuka zolnierzy, ktorzy znajduja sie na tile o indexie
 /// zadanym w parametrze.
 /// </summary>
 /// <param name="position">Index elementu planszy.</param>
 /// <returns>True - jesli zolnierz znjaduje sie na tym kawalku planszy, w przeciwnym
 /// przypadku false.</returns>
 public static Predicate <Soldier> FindSoldierByPosition(int position)
 {
     return(delegate(Soldier s)
     {
         int pos = Mathematics.PositionToIndex(s.Position.X);
         return pos == position;
     });
 }
Esempio n. 2
0
        public static Predicate <General> FindGeneralFromInterval(int start, int end)
        {
            return(delegate(General s)
            {
                int pos = Mathematics.PositionToIndex(s.Position.X);
                return start <= pos && pos <= end;

                return false;
            });
        }
Esempio n. 3
0
        public static Predicate <Soldier> FindSoldierFromInterval(int start, int end)
        {
            return(delegate(Soldier s)
            {
                int pos = Mathematics.PositionToIndex(s.Position.X);
                return start <= pos && pos <= end;

                return false;
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Konstruktor czteroparametrowy.
        /// Wazna jest kolejnosc.
        /// </summary>
        /// <param name="point1">Pierwszy wierzcholek.</param>
        /// <param name="point2">Drugi wierzcholek.</param>
        /// <param name="point3">Trzeci wierzcholek.</param>
        /// <param name="point4">Czwarty wierzcholek.</param>
        /// <autor>Michal Ziober</autor>
        public Quadrangle(PointD point1, PointD point2, PointD point3, PointD point4)
        {
            PeakManager peakManager = new PeakManager(point1, point2, point3, point4);

            if (peakManager.Peaks.Count == 4)
            {
                peaks = peakManager.Peaks;
            }
            else
            {
                peaks = new List <PointD>();
            }
            angle         = 0;
            climbingAngle = 0;
            width         = Mathematics.MaxCoordinate(true, point1, point2, point3, point4).X -
                            Mathematics.MinCordinate(true, point1, point2, point3, point4).X;
            height = Mathematics.MaxCoordinate(false, point1, point2, point3, point4).Y -
                     Mathematics.MinCordinate(false, point1, point2, point3, point4).Y;
        }
Esempio n. 5
0
        /// <summary>
        /// Konstruktor czteroparametrowy.
        /// </summary>
        /// <param name="point1">Wierzcholek Nr:1.</param>
        /// <param name="point2">Wierzcholek Nr:2.</param>
        /// <param name="point3">Wierzcholek Nr:3.</param>
        /// <param name="point4">Wierzcholek Nr:4.</param>
        public PeakManager(PointD point1, PointD point2, PointD point3, PointD point4)
        {
            peaks = new List <PointD>();

            List <PointD> tmpList = new List <PointD>();

            tmpList.Add(point1);
            tmpList.Add(point2);
            tmpList.Add(point3);
            tmpList.Add(point4);

            PointD minXPointD = Mathematics.MinCordinate(true, point1, point2, point3, point4);
            PointD minYPointD = Mathematics.MinCordinate(false, point1, point2, point3, point4);
            PointD maxXPointD = Mathematics.MaxCoordinate(true, point1, point2, point3, point4);
            PointD maxYPointD = Mathematics.MaxCoordinate(false, point1, point2, point3, point4);

            AddFirstPeak(minXPointD, tmpList);
            AddSecondPoint(maxYPointD, tmpList);
            AddThirdPeak(maxXPointD, tmpList);
            AddFourthPoint(minYPointD, tmpList);
        }