final List<NEATLinkGene> selectedLinks = new ArrayList<NEATLinkGene>();
final List<NEATNeuronGene> selectedNeurons = new ArrayList<NEATNeuronGene>();
int curMom = 0; // current gene index from mom
int curDad = 0; // current gene index from dad
NEATLinkGene selectedGene = null;
// add in the input and bias, they should always be here
final int alwaysCount = ((NEATGenome)parents[0]).getInputCount()
+ ((NEATGenome)parents[0]).getOutputCount() + 1;
for (int i = 0; i < alwaysCount; i++) {
addNeuronID(i, selectedNeurons, best, notBest);
}
while ((curMom < mom.getNumGenes()) || (curDad < dad.getNumGenes())) {
NEATLinkGene momGene = null; // the mom gene object
NEATLinkGene dadGene = null; // the dad gene object
long momInnovation = -1;
long dadInnovation = -1;
// grab the actual objects from mom and dad for the specified
// indexes
// if there are none, then null
if (curMom < mom.getNumGenes()) {
momGene = mom.getLinksChromosome().get(curMom);
momInnovation = momGene.getInnovationId();
}
if (curDad < dad.getNumGenes()) {
dadGene = dad.getLinksChromosome().get(curDad);
dadInnovation = dadGene.getInnovationId();
}
// now select a gene for mom or dad. This gene is for the baby
if ((momGene == null) && (dadGene != null)) {
if (best == dad) {