Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

RE: Genetic Programming or breeding Perls

by runrig (Abbot)
on Sep 27, 2000 at 03:38 UTC ( #34133=note: print w/ replies, xml ) Need Help??


in reply to Genetic Programming or breeding Perls

Very cool :) One small nitpick though, is the use of map in void context. Specifically (in Individual->get_code):

my $code = ""; map { $code .= $_} (@{$self->{GENES}});
could be:
my $code = join('', @{$self->{GENES}});
Also, if your Individual->create() method returned $self at the end, you could change this (in Population->new):
for my $i (0 .. $self->{SIZE}) { my $individual = Individual->new(); $individual->create(); push (@{$self->{INDIVIDUALS}}, $individual); }
To this:
push (@{$self->{INDIVIDUALS}}, Individual->new->create) for 0..$self-> +{SIZE};
Or maybe even this:
$self->{INDIVIDUALS} = [ map {Individual->new->create} 0..$self->{SIZE +} ];
But now I'm probably being too nit-picky :) </code>


Comment on RE: Genetic Programming or breeding Perls
Select or Download Code
Replies are listed 'Best First'.
RE: RE: Genetic Programming or breeding Perls
by gumpu (Friar) on Sep 27, 2000 at 21:38 UTC

    Feel free to nitpick some more :), the replacement you suggest look very elegant. It's my first "complicated" perl program so there are bound to be more points that can be improved.

    Have Fun

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://34133]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (17)
As of 2015-07-29 18:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (267 votes), past polls