Ejemplo n.º 1
0
        /// <summary>
        /// Gets the readable neurons from the containers of the type requested (and skips the current container)
        /// </summary>
        private static List<Tuple<ContainerInput, List<INeuron>, double>> BuildExternalLinksRandom_Continue_Eligible(BotConstruction_PartMap partMap, NeuronContainerType containerType, int currentIndex, ContainerInput[] containers, List<INeuron>[] readable)
        {
            var retVal = new List<Tuple<ContainerInput, List<INeuron>, double>>();

            for (int cntr = 0; cntr < containers.Length; cntr++)
            {
                if (cntr == currentIndex)
                {
                    continue;
                }

                if (containers[cntr].ContainerType != containerType)
                {
                    continue;
                }

                double? weight = null;
                foreach (var mapped in partMap.Actual)
                {
                    if ((mapped.Item1.Token == containers[currentIndex].Token && mapped.Item2.Token == containers[cntr].Token) ||
                        (mapped.Item2.Token == containers[currentIndex].Token && mapped.Item1.Token == containers[cntr].Token))
                    {
                        weight = mapped.Item3;
                        break;
                    }
                }

                if (weight == null)
                {
                    // The map doesn't hold a link between these two containers
                    continue;
                }

                retVal.Add(Tuple.Create(containers[cntr], readable[cntr], weight.Value));
            }

            return retVal;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the readable neurons from the containers of the type requested (and skips the current container)
        /// </summary>
        private static List<Tuple<ContainerInput, List<INeuron>>> BuildExternalLinksRandom_Continue_Eligible(NeuronContainerType containerType, int currentIndex, ContainerInput[] containers, List<INeuron>[] readable)
        {
            List<Tuple<ContainerInput, List<INeuron>>> retVal = new List<Tuple<ContainerInput, List<INeuron>>>();

            for (int cntr = 0; cntr < containers.Length; cntr++)
            {
                if (cntr == currentIndex)
                {
                    continue;
                }

                if (containers[cntr].ContainerType != containerType)
                {
                    continue;
                }

                retVal.Add(new Tuple<ContainerInput, List<INeuron>>(containers[cntr], readable[cntr]));
            }

            return retVal;
        }
Ejemplo n.º 3
0
 public ContainerInput(long token, INeuronContainer container, NeuronContainerType containerType, Point3D position, Quaternion orientation, double? internalRatio, Tuple<NeuronContainerType, ExternalLinkRatioCalcType, double>[] externalRatios, int brainChemicalCount, NeuralLinkDNA[] internalLinks, NeuralLinkExternalDNA[] externalLinks)
 {
     this.Token = token;
     this.Container = container;
     this.ContainerType = containerType;
     this.Position = position;
     this.Orientation = orientation;
     this.InternalRatio = internalRatio;
     this.ExternalRatios = externalRatios;
     this.BrainChemicalCount = brainChemicalCount;
     this.InternalLinks = internalLinks;
     this.ExternalLinks = externalLinks;
 }