public static void GetLinks(out LinkBrain2D[] brainLinks, out LinkIO[] ioLinks, Item2D[] brains, Item2D[] io, IOLinkupPriority ioLinkupPriority = IOLinkupPriority.ShortestDistFirst, double brainLinkResistanceMult = 10) { if (brains == null || brains.Length == 0) { brainLinks = null; ioLinks = null; return; } else if (brains.Length == 1) { brainLinks = null; ioLinks = Enumerable.Range(0, io.Length).Select(o => new LinkIO(0, o, brains, io)).ToArray(); return; } // Link brains:brains SortedList<Tuple<int, int>, double> allBrainLinks; Worker2D_Voronoi.BrainLinks(out allBrainLinks, out brainLinks, brains); // Link brains:io ioLinks = IOLinks(brains, io, allBrainLinks, ioLinkupPriority, brainLinkResistanceMult); }
public static void GetLinks(out LinkBrain2D[] brainLinks, out LinkIO[] ioLinks, Item2D[] brains, Item2D[] io) { if (brains == null || brains.Length == 0) { brainLinks = null; ioLinks = null; return; } else if (brains.Length == 1) { brainLinks = null; ioLinks = Enumerable.Range(0, io.Length).Select(o => new LinkIO(0, o, brains, io)).ToArray(); return; } // Link brains:brains SortedList<Tuple<int, int>, double> allBrainLinks; BrainLinks(out allBrainLinks, out brainLinks, brains); // Link brains:io ioLinks = IOLinks(brains, io, allBrainLinks); }