Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

andy pondering Re: Re: Re: Re: JAPH-ing Genetically

by andye (Curate)
on May 23, 2001 at 17:46 UTC ( #82551=note: print w/replies, xml ) Need Help??

in reply to Re: Re: Re: JAPH-ing Genetically
in thread JAPH-ing Genetically

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.


  • Comment on andy pondering Re: Re: Re: Re: JAPH-ing Genetically

Replies are listed 'Best First'.
Re: andy pondering Re: Re: Re: Re: JAPH-ing Genetically
by Anonymous Monk on May 23, 2001 at 18:19 UTC
    p is not a syntax error (test it) . Or do you mean a string which is a valid program and contains the chars "syntax error"? Then you have misunderstood. I meant "syntax error" in $@ after eval
      I meant 'the probability of a syntax error'. Andy.
        Not so large. The DWIM in perl deciphers a good part of junk to things no one has dreamed of. There are many warnings. A variable can have a junk name. The possibilities are endless. You could split your string and use the half(third...)that doesn't contain the error. Or how many parts contain an error if the string is cut haphazardly(=1/FITNESS).
Re: andy pondering Re: Re: Re: Re: JAPH-ing Genetically
by ambrus (Abbot) on Apr 13, 2008 at 20:00 UTC

    In Re (Obfu generator for): Ode for getprotobyname, I randomly generate tr/// patterns, and check if the "just another perl hacker" message can be generated as a result of that transliteration. Perhaps you could try generating such patterns genetically, with the goal function being the number of different characters you cannot generate.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://82551]
[Discipulus]: with eskimo greeting is a little bit impressing, anyway
[Eily]: I actually used the eskimo greeting :P, I just wrote the "canonical" form of the oneliner here
[Discipulus]: next time you can add `SARGV-1` and if still not impressed pass a 'rm -f..' as last arg
[Eily]: :)
[Eily]: or I might be tempted to send him an Acme::EyeDropsed file next time
[Eily]: Acme::Bleach is tempting, but it will look like I'm just using the one module that does precisely exactly what he wants

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2017-04-26 15:10 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (482 votes). Check out past polls.