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); }
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); }
public int ManhattanDistance(int x, int y, ChronalCoords pt) { int dist = Math.Abs(x - pt.X) + Math.Abs(y - pt.Y); return(dist); }