On Mon, 17 Mar 2003, drieux wrote:

> p0: thank for the URL's - forgive my lack of awareness
> that this had been 'named'.

Oh yeah, and written about at great length :)


This URL gives a pretty good overview of the mechanics of quines:

    http://www.eleves.ens.fr:8080/home/madore/computers/quine.html

The core of it is this section:

    http://www.eleves.ens.fr:8080/home/madore/computers/quine.html#sec_princ



Especially fun are mutilingual quines, called "polyglots":

    http://www.nyx.net/~gthompso/self_mult.htm

> p1: So the problem then is getting a quine that would work with 'use
> strict' - which I seem to be having the problem with - as I can get the
> quine to work as 'written' but not when I try to load in a 'use strict'
> - the eval baulks at the process...

Maybe this'll help:

    % sudo perl -MCPAN -e "install Quine"

As described here:

    http://aspn.activestate.com/ASPN/CodeDoc/Quine/Quine.html

And demonstrated here:

    #!/usr/bin/perl -w

    use Quine;

    # rest of code here

heh.

More Perl examples, running under use strict, here:

    http://perlmonks.thepen.com/Obfuscated%20Code.html



But really, the best I've seen was Damian Conway's SelfGOL:

    The Horror That is SelfGOL

    SelfGOL was Damian Conway's intended entry to the Obfuscated Perl
    Contest. It can print its own source code (self-replicate), rewrite
    other Perl programs so they can print their own source code (and
    still perform their original functions), detect un-rewritable Perl
    programs, play John Conway's Game of Life using its own source code
    or a specified file as a pattern for the board with a board of
    arbitrary size, or animate a rotating banner of an arbitrary short
    amount of text. SelfGOL's source is under 1000 bytes of standard
    Perl, does not import any modules, and doesn't use a single if,
    unless, while, until, for, foreach, goto, next, last, redo, map, or
    grep.

    Usage:

      selfgol -s outputs its own source code.

      selfgol < perlprog.pl makes perlprog.pl self-replicating (with a
      command line switch of -s), outputs new source to STDOUT.

      selfgol -g [-y=## -x=##] [< gamefile] plays the Game of Life with
      its own source code or an arbitrary file, with optional height
      and width restrictions.

      selfgol -d[=bannertext] displays a rotating banner with the
      provided text. If no text is provided, it uses the program name
      as the text.

    SelfGOL was written to win all four categories in the Obfuscated
    Perl contest (3rd year, I believe, whose web pages are no longer
    available) and still comply with other restrictions of not using
    modules and being under 1000 bytes. Alas, the rules were
    drastically changed for the following year's contest, and so it was
    never entered.

http://libarynth.f0.am/cgi-bin/view/Libarynth/SelfGOL
http://yetanother.org/damian/seminars/Extreme.html

But to really grok SelfGOL -- well no, that's impossible, but to get as
close as you're ever likely to get -- you really have to attend Conway's
"Extreme Programming with Perl" talk. It's truly diabolical :)



-- 
Chris Devers    [EMAIL PROTECTED]

price/performance, n.
Marketing: A ratio usually non-computable since the numerator is
subject to random discounts and the denominator vanishingly small. See
also $CALL. Compare LEARNING CURVE.

    -- from _The Computer Contradictionary_, Stan Kelly-Bootle, 1995

Reply via email to