예제 #1
0
파일: Overlaps.cs 프로젝트: quinnc/AoC
        public override void Find(WireRoute w1, WireRoute w2)
        {
            Reset();

            Parallel.For(0, w1.Route.Count,
                         index =>
            {
                var w2Index = w2.Route.IndexOf(w1.Route[index]);

                if (w2Index >= 0)
                {
                    overlaps.Add(new Tuple <int, int>(index + 1, w2Index + 1));
                }
            });
        }
예제 #2
0
파일: Overlaps.cs 프로젝트: quinnc/AoC
        public virtual void Find(WireRoute w1, WireRoute w2)
        {
            Reset();

            foreach (var pointIn2 in w1.Route)
            {
                foreach (var pointIn1 in w2.Route)
                {
                    if (pointIn1.Item1 == pointIn2.Item1 &&
                        pointIn1.Item2 == pointIn2.Item2)
                    {
                        overlaps.Add(pointIn1);
                        // don't search anymore in case there are loops
                        break;
                    }
                }
            }
        }