File tree 1 file changed +7
-7
lines changed
1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -136,24 +136,24 @@ Population Population::Reproduce() {
136
136
}
137
137
Organism& parent1 = species[idx1];
138
138
Organism& parent2 = species[idx2];
139
- Genome* child = new Genome ;
139
+ Genome child;
140
140
141
141
// determine relative fitness for mating
142
142
if (parent1.fitness > parent2.fitness ) {
143
- * child = parent1->MateWith (*parent2);
143
+ child = parent1->MateWith (*parent2);
144
144
} else if (parent2.fitness > parent1.fitness ) {
145
- * child = parent2->MateWith (*parent1);
145
+ child = parent2->MateWith (*parent1);
146
146
} else {
147
147
// break a fitness tie with a check on size
148
148
if (parent1->Size () > parent2->Size ()) {
149
- * child = parent1->MateWith (*parent2);
149
+ child = parent1->MateWith (*parent2);
150
150
}
151
151
else { // equal size or parent 2 is larger
152
- * child = parent2->MateWith (*parent1);
152
+ child = parent2->MateWith (*parent1);
153
153
}
154
154
}
155
- child-> Mutate ();
156
- progeny.push_back (* child);
155
+ child. Mutate ();
156
+ progeny.push_back (child);
157
157
158
158
159
159
}
You can’t perform that action at this time.
0 commit comments