override public void part1() { InputLoader il = new InputLoader(3); List <Line> lines1 = getLinesFromInput(il.inputStringList[0]); List <Line> lines2 = getLinesFromInput(il.inputStringList[1]); int lowestDist = (from res in (from p in Library2D.getIntersections(lines1, lines2) select(System.Math.Abs((int)p.x) + System.Math.Abs((int)p.y))) where (res != 0) select res).Min(); System.Console.WriteLine("Day3: Solution1:" + lowestDist); }
override public void part2() { InputLoader il = new InputLoader(3); List <Line> lines1 = getLinesFromInput(il.inputStringList[0]); List <Line> lines2 = getLinesFromInput(il.inputStringList[1]); List <Point> points = Library2D.getIntersections(lines1, lines2); int low = (from res in (from s in points select(Library2D.getDistanceToPoint(s, lines1) + Library2D.getDistanceToPoint(s, lines2))) where res != 0 select res).Min(); System.Console.WriteLine("Day3: Solution2:" + low); }