|Think about Loose Coupling|
Problem is, an individual that generates a syntax error might only be one character different to an individual that prints the required string. Or it might be total rubbish.
The first should (for this method to work) be fitter than the second, but I don't know a way to quantify that.
Also, p(syntax error) is very high for constructing a valid Perl string randomly. The chances are that all members of a population would generate syntax errors - at which point they'd all have the same fitness.
A better approach would be to create a baby language safe (or safer) from syntax errors and eval that. Like maybe just arithmetic operators and numbers.
Although - it's just occured to me - you'd be on fairly safe ground with a subset of a highly structured language like Logo. And you could evaluate fitness by checking how similar the figure drawn was to your target figure.
In reply to andy pondering Re: Re: Re: Re: JAPH-ing Genetically