final int offspringIndex) {
final EncogProgram parent1 = (EncogProgram) parents[0];
final EncogProgram parent2 = (EncogProgram) parents[1];
offspring[0] = null;
final EncogProgramContext context = parent1.getContext();
final int size1 = parent1.getRootNode().size();
final int size2 = parent2.getRootNode().size();
boolean done = false;
int tries = 100;
while (!done) {
final int p1Index = rnd.nextInt(size1);
final int p2Index = rnd.nextInt(size2);
final LevelHolder holder1 = new LevelHolder(p1Index);
final LevelHolder holder2 = new LevelHolder(p2Index);
final List<ValueType> types = new ArrayList<ValueType>();
types.add(context.getResult().getVariableType());
findNode(rnd, parent1.getRootNode(), types, holder1);
findNode(rnd, parent2.getRootNode(), types, holder2);
if (LevelHolder.compatibleTypes(holder1.getTypes(),
holder2.getTypes())) {
final EncogProgram result = context.cloneProgram(parent1);
final ProgramNode resultNode = parent1.findNode(p1Index);
final ProgramNode p2Node = parent2.findNode(p2Index);
final ProgramNode newInsert = context.cloneBranch(result,
p2Node);
result.replaceNode(resultNode, newInsert);
offspring[0] = result;
done = true;
} else {