- or download this
sub gene_length {
my @gls = sort map { length } keys %genome;
die "Invalid genotype" unless $gls[0] == $gls[$#gls];
return $gls[0];
}
- or download this
use List::Util 'first';
sub check_for_winner {
return first { get_result($_) == $target } @population
}
- or download this
use List::Util 'sum';
sub get_population_fitness_score {
return sum map { get_fitness_score($_) } @population;
}