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