public static IEnumerable <Bee> Generate(int populationSize) { foreach (var _ in Enumerable.Range(0, populationSize)) { yield return(BeeGenerator.Generate()); } }
public bool IsReSearchLimitExceed() { //If the research count exceed the limit //Generate a new bee //This is turning self into a scout bee if (ReSearchCount > ReSearchLimit) { this.Clear(); foreach (var h in BeeGenerator.Generate()) { this.Add(h); } //Reset count ReSearchCount = 0; return(true); } return(false); }