Esempio n. 1
0
        private static HashSet <Nanobot> FindBiggestIntersection(Nanobot nanoRobot, Dictionary <Nanobot, HashSet <Nanobot> > nanoRobots)
        {
            var intersectingRobots = nanoRobots[nanoRobot];

            var max = intersectingRobots
                      .Where(r => nanoRobot != r)
                      .Select(r =>
            {
                var ppp = FindIntersectingRobots(r, intersectingRobots).ToHashSet();
                return(ppp);
            })
                      .MaxBy(r => r.Count);

            return(max);
        }
Esempio n. 2
0
 private static HashSet <Nanobot> FindIntersectingRobots(Nanobot r, IEnumerable <Nanobot> nanoRobots)
 {
     return(nanoRobots
            .Where(ro => ro.IsNanobotIntersecting(r))
            .ToHashSet());
 }