Exemplo n.º 1
0
        /// <summary>
        /// Finds the index and value of the winner with the biggest additiveSurvS
        /// </summary>
        /// <returns>Winner Species name</returns>
        public string Winner()
        {
            var max = AdditiveSurvS.Select((value, index) => new { value, index })
                      .OrderByDescending(vi => vi.value)
                      .First();

            return("Winner is : " + HomoFactory.makeHomo(max.index).GetType().ToString().Split('.').Last());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates populations of h**o species -> each specie's pop. will be random.
        /// </summary>
        /// <param name="countPerPop">maximum count per population</param>
        public void CreatePop(int maxCountPerPop)
        {
            Random r = new Random();

            for (int i = 0; i <= 2; i++)
            {
                int popSize = r.Next(0, maxCountPerPop);
                for (int j = 0; j < popSize; j++)
                {
                    population.Add(HomoFactory.makeHomo(i));

                    AdditiveSurvS[i] += Population.ElementAt(population.Count - 1).SurvivabilityScore;
                }
            }
        }