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

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Here is the entry that I sent into the TPJ 5th annual obfuscated Perl contest. I entered it in as a diversion. The code is actually a team effort, I wrote the core and then Tye and I set to work obfuscating and souring (removing the sugar from) the code. And yes, it is 'strict' and does not generate warnings when used correctly. It can also take user input on the command line.
($@,$?)=(@ARGV,9,9);$:=1-$?*$@;print"# ",'##'x($@-2),"# # ";$_[0][$_]=$_[$?+1][$_]=8for 0..$@;$_[$_][0]=$_[$_][$@+1]=8for 0..$?;$/=1+rand$?,$.=1+rand$@;@@=[$.,$/];$_[$/][$.]=$^=4;while($:) {$"=$^-->3?rand 4:++$"%4;1>$"?$.--:2>$"?$/--:2^$"?++$/:$.++;if($_[$/][ $.]&&1){pop@@,$^=4if!$^;($.,$/)=@{$@[-1]};next}$_[$/][$.]=$^=4;$"< 2?$_[$/][$.]|=1<<$":($_[$@[-1][1]][$@[-1][0]]|=1<<$"-2);push@@ ,[$.,$/];++$:}print"#",map({$_%2?' ':' #'}@$_[1..$@])," #",map({2&$_?' #':'##'}@$_[1..$@]),"\n"for@_[1..$?]
Disclaimer: The contest required the code to work under Perl 5.6, some things in this code might not work on older versions of Perl. (Although I think it will work with versions 5.005 and newer)

Update: Nov 2, 2000
Well, the results are in over at TPJ, and we didn't win. We didn't even place.
Oh well, there is always next year!


In reply to OneWay by Adam

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (5)
    As of 2014-10-02 11:06 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      What is your favourite meta-syntactic variable name?














      Results (54 votes), past polls