Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

The Best Ever

by BooK (Curate)
on Nov 13, 2000 at 18:33 UTC ( #41310=obfuscated: print w/replies, xml ) Need Help??

Well, this one was too long (951 bytes) for category 4 The Old Standby, but was rated The Best Ever by the judges... (I did submit it for Inner Beauty, but hey)

The Perl part need an ANSI term for it use some escape codes for highlighting, and the PostScript part need ghostscript or you friendly neighborhood PS printer.

Please note that whitespace actually holds information. And yes, it is actually PostScript: it ends with showpage...

/;{}def/#{def}def/$_={/Times-Bold exch selectfont}#/_{rmoveto}#/"{dup} +#/*/!/$ ;/q{exch}#/x ; {/J q #}#/.{/T q #}#{stringwidth}#{}#{}# 14 string dup +dup dup 260 40 moveto 90 rotate ; %/}};$0='"\e[7m \e[0m"';@ARGV=split//,revers +e q(ThePerl). q(Journal) x 220 ; q ; 0 T putinterval exch 7 J putinterva +l ; ; $_= q /m$ pop T($*!$"=!$ " )pop " * true% ? $ " $!" " !! !! % !" +!" ! ! charpath {!"""}pop $ pop{""!}pop ! neg{!#}pop 220 ! neg _{!!}pop J f +alse %T charpath clip " pop 0 " moveto 6{!!}pop $_= 105{!!}pop {$ ! $ " ! #! + ##} pop{dup dup $ ! " pop pop q{"}pop 22{dup show}repeat {"}pop q 22 mul{$ + "} pop neg{!#! $ "}pop ! 8 .65 mul{$ # # $}pop ! neg{"}pop _ pop{"}pop } rep +eat pop " { $ " ! ! ! $ " ! !" "#" #"!"""""! #" " # "m/;@ARGV=(@ARGV[-14..-1 +])x50;q} 0 "%};s/m[ou]|[-\dA-ln-z.\n_{}]|\$_=//gx;s/(.)(?{$*=''})/('$*.='.(++$ +# %2?'':"$0;").'pop;')x(ord($1)-31).'$*'/gee;s/((.(\e\[.m)*|.){77})/$1\n +/g;print ; sub showpage {}

Excerpt from the SOLUTION file:

This program has a lot to tell. Though Perl and PostScript are very different in appearance (one if infixed, the other postfixed, one works with lists, the other with dictionaries...), in this case they performed quite hand in hand. I must add that PostScript is very well suited for obfuscation even for novices, thanks to the def operator.

If you look closer at the output of these two programs, you will notice that the highlighted part, the one that is missing in the output of the Perl program, is exactly (your screen/eyes/printer resolution may vary) the one that is printed by the PostScript file. Isn't this some complementarity?

Replies are listed 'Best First'.
Re: The Best Ever
by ambrus (Abbot) on Oct 09, 2012 at 20:52 UTC

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (9)
As of 2023-03-28 08:37 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (66 votes). Check out past polls.