예제 #1
0
        public List <ChronalCoords> ParseDataFile(string datapath)
        {
            List <ChronalCoords> list = new List <ChronalCoords>();
            var rows = DataHelpers.ReadLinesFromFile(datapath);

            foreach (var row in rows)
            {
                var           xy = row.Split(new char[] { ',' });
                ChronalCoords cc = new ChronalCoords();
                cc.X = int.Parse(xy[0].Trim());
                cc.Y = int.Parse(xy[1].Trim());
                list.Add(cc);
            }
            return(list);
        }
예제 #2
0
        public ChronalCoords FindMaxXY(List <ChronalCoords> coords)
        {
            ChronalCoords max = new ChronalCoords();

            foreach (var item in coords)
            {
                if (max.X < item.X)
                {
                    max.X = item.X;
                }
                if (max.Y < item.Y)
                {
                    max.Y = item.Y;
                }
            }

            return(max);
        }
예제 #3
0
        public int ManhattanDistance(int x, int y, ChronalCoords pt)
        {
            int dist = Math.Abs(x - pt.X) + Math.Abs(y - pt.Y);

            return(dist);
        }