Exemplo n.º 1
0
        /// <summary>
        /// Forces the genome to get a neuron with the same innovation nb
        /// as the targetNeuron. If there isn't one, create.
        /// </summary>
        private Neuron ForceGetNeuron(Neuron targetNeuron)
        {
            var result = Neurons.FirstOrDefault(x => x.InnovationNb == targetNeuron.InnovationNb);

            if (result == null)
            {
                result = new Neuron(targetNeuron);
                Neurons.Add(result);
            }
            return(result);
        }