public Species(string n) { SpeciesName = n; for (int i = 0; i < GeneCount; i++) { Sex s = Sex.Either; s.RandomEitherSex(); Baseline.Add(new Gene((byte)rng.Next(0, 256), s)); } Debug.LogError(Baseline.Count); for (int i = 0; i < 40; i++) { Individual x = new Individual(this); } for (int generation = 0; generation < 15; generation++) { int count = Members.Count; int sanityLimit = 1000; int sanity = 0; for (int i = 0; i < count / 2; i++) { Individual a = Members.GetRandom(); Debug.LogWarning(a.Generation + " A Generation"); Individual b = Members.GetRandom(); while ((b.sex == a.sex || a == b) && sanity < sanityLimit) { b = Members.GetRandom(); sanity++; } if (sanity > sanityLimit) { Debug.LogError("Sanity limit reached"); } if (a.sex == Sex.Male) { Individual.Reproduce(a, b); } else { Individual.Reproduce(b, a); } } } }