/// <summary> /// Simulates the Multiplication Activity of Rabbits /// </summary> /// <returns> /// Number of Rabbits that were Born /// </returns> private int rabbitMultipliaction() { int num = Rabbit.BirthRate[RabbitsCount][VegetationLevel] * (RabbitsCount / 2); Generation <Rabbit> newBorn = new Generation <Rabbit>(num); RabbitsGenerations.Add(newBorn); RabbitsGenerations.Sort(); return(num); }
/// <summary> /// Merge The Current Lis tof Rabbits Generation with another One /// </summary> /// <param name="o"> The List of Rabbits To merge With</param> public void Merge(List <Generation <Rabbit> > o) { RabbitsGenerations.Sort(); foreach (Generation <Rabbit> g in o) { int t = RabbitsGenerations.BinarySearch(g); if (t < 0) { t = ~t; RabbitsGenerations.Insert(t, g); } else { RabbitsGenerations[t].Animals.AddRange(g.Animals); } RabbitsCount += g.Count; } }