// initializes a species with a leader genome and an ID number Species::Species(const Genome& a_Genome, int a_ID) { m_ID = a_ID; // copy the initializing genome locally. // it is now the representative of the species. m_Representative = a_Genome; m_BestGenome = a_Genome; // add the first and only one individual m_Individuals.push_back(a_Genome); m_Age = 0; m_GensNoImprovement = 0; m_OffspringRqd = 0; m_BestFitness = a_Genome.GetFitness(); m_BestSpecies = true; // Choose a random color RNG rng; rng.TimeSeed(); m_R = static_cast<int>(rng.RandFloat() * 255); m_G = static_cast<int>(rng.RandFloat() * 255); m_B = static_cast<int>(rng.RandFloat() * 255); }
bool genome_greater(Genome ls, Genome rs) { return (ls.GetFitness() > rs.GetFitness()); }