I have written the code for a genetic algorithm and have the crossover function, mutation function, parent selector function and a function to transfer genes. Now I want to put it all together and would like to know if the following code is good programming practice or not.
Species Parents[popSize];
Species Children[popSize];
for(int gen = 0 ; gen < 100 ; gen++)
{
for(int i = 0; i < popSize ; i ++)
{
int parentA = chooseParent(Parents);
int parentB = chooseParent(Parents);
crossOver(Parents[parentA] , Parents[parentB] , Children[i]);
Children[i].mutate();
}
for(int i = 0; i < popSize ; i ++)
{
transfereGenes(Children[i], Parents[i]);
}
}