Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

A self-replicating Quine-Statement generator with an optional 'paradox' mode

by domm (Chaplain)
on Feb 20, 2002 at 08:37 UTC ( [id://146526]=obfuscated: print w/replies, xml ) Need Help??

#!/usr/bin/perl -s qq#$/=$x;#;#q#is a Quine statement#;qq $/='qq';$i=shift||2;open(i,$0);$i--;$f=<i>; $f.=$c=<i>;p('^.','','(..$)','','#;#',''); $p&&p(q disd,q pis notp);$s='"\n",eval $c,' .(('&j,eval $c,')x$i).'&a';$d&&eval$c||print reverse (eval $s);$f.=<i>;$d&&&h; sub j {p('#.$','" #');''} sub a {'"' x$i} sub p {@_?(eval'$c=~s/'.(shift).'/'.(shift).'/')&&p(@_):0} sub h {print $f}
This was done at the 4th German Perl Workshop. They didn't managed to put anything on the conference bags, so they gave out plain bags and special markers and started a "onebagger" competition. I wrote this on the backside, and '{picture of a camel} is not a camel' on the front (there had to be a camel on the bag).

UPDATE: Pictures available now, thanks to Marc Lehmann:
Front
Back

My bag even got a price (but then, only three bags were submitted, and there were three prices ...)!

So, what is this?

This obfu was inspired by TheDamians talk (which was great) about SelfGOL (whis is sick & great). Call the script with a number as an argument, and it prints the specified levels of correctly quoted Quine statements. Call it with -p and it is in 'paradox mode'. Call it with -d and it dumps the source (in case you don't have 'cat' nearby).

The script isn't obfuscated very much (I didn't apply any of those tricks to hide the code completly), but you can't deparse it with perl -MO=Deparse (that is, if you run Deparse on it, and then run the output as a script, it won't work)

BTW, the japh-subnames are there just for fun, could be anything, but then, TMTOWT print japh

  • Comment on A self-replicating Quine-Statement generator with an optional 'paradox' mode
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: obfuscated [id://146526]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-23 22:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found