Esempio n. 1
0
        public void Execute()
        {
            var path1 = new WirePath(Input1).BuildStepByStepPath().Zip(Enumerable.Range(1, int.MaxValue), (p, i) => (id: 1, idx: i, p)).ToList();
            var path2 = new WirePath(Input2).BuildStepByStepPath().Zip(Enumerable.Range(1, int.MaxValue), (p, i) => (id: 2, idx: i, p)).ToList();

            var comparer = new LoggingComparer();

            path1.Intersect(path2, comparer).ToList();
            Intersections = comparer.Log;

            ResultMinDistance = Intersections.Min(x => x.Item1.p.ManhattanDistanceToOrigin);
            ResultMinSteps    = Intersections.Min(x => x.Item1.idx + x.Item2.idx);

            Display = GetDisplay(path1.Select(x => x.p), path2.Select(x => x.p));
        }