Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hello monks,
Here's my latest effort, it's pure perl, so should run anywhere.

It is parametised so it will take the number of boxes in the output as an argument in the form:
 # perl blah.pl 19x20
(19x20 is the default)

This will produce a variable sized file (default is normally around 6Mb) called al.XXX (where XXX would reveal the surprise) in the directory from which it is run

$_=q^($w,$h +)=s plit/x/,shift||"19x20";$q=10+10*$w;$r=20+10*$h;@m=((31,(1 +5)x ($w-1))x$h,(31)x$w);$m[$c]|=16,!(@a=grep!($m[$c+$$_[0]]&16+$|*$$_[1]) +,[- 1,8],[1,1],[$w,4],[-$w,2])?$c=pop@p:${($i,$j)=@{$a[rand@a ]};$m[$c]&=~ (8/$j);push@p,$c;$m[$c+=$i]&=~$j;++$u-$h*$w+$h||map$_&=15,@m,splice(@ +p), $c=$|=1}until$|&$c+2>$w*$h;$C=$q-4*int$q/4;$A=($q+$C)*$r;$u=pack"x"x( +($q +$C)*$r);subZd{my($f,$g,$h,$i,$e)=@_;@a=sort{"000$a"<=>"000$b"}$h,$i| +|$h ;for($a[0]..$a[1]){$s=($r-$_)*($q+$C)+$f;vec($u,$_,8)=$e||2 for$s..$s ++$g -1}};subZt{$a=shift;$x=10*($a%$w);$y=10*(2+int$a/$w)};dZ9,$q-20,10;dZ +9,$ q-20,$r-10;dZ9,1,10,$r-10;dZ$q-11,1,10,$r-10;map{t$_;if($_%$w){$m[$_] +&2? d$x-1,11,$y:"";$m[$_]&8?d$x+9,1,$y-10,$y:"";}}0..-1+$w*$h;$F="LIST";o +pen (FH,">al.avi");binmodeZFH;selectZFH;printZpack"V*",/\d/?$_:unpack"V*" +,$_ Zfor"RIFF",(1256+($A+24)*($B=3+scalar@p)),"AVIZ$F",1216,"hdrlavih",56 +,50 0000,32,0,2064,$B,0,1,$A,$q,$r,(0)x4,$F,1140,"strlstrh",56,"vids",(0) +x4, 1,10,0,$B,$A,-1,(0)x3,"strf",1064,40,$q,$r,pack("vv",1,8),0,$A,(0)x4, +pac k(("C"x1024),(0xff)x3,0,128),$F,(4+($A+8)*$B),"movi";map{printZSTDOUT +"." ;t$z||1;$l=$x;$t=$y;t$_;$ri=$x;if($l>$x){$ri=$l;$l=$x}d$l+2,5+$ri-$l, +($t <$y?$t:$y)-7,($t<$y?$y:$t)-3,1;$z=$_;print"00db".pack("V",$A).$u}@p,( +-1+ $w*$h)x3;print"idx1".pack"V",16*$B;$o=4;for(1..$B){print"00db".pack"V +VV" ,16,$o,$A;$o+=$A+8}^;s#((?{$a.=$+})\s?(\S*)\s?)*#$a=~s/Z/ /g;$a#see
(that's supposed to be a clapboard btw!)

If there is enough interest i'll write a deobfuscation/explanation of what went into it,
I've written a clean version here.

In the meantime some of my references and some other notes are in the spoiler below:

I hope you all enjoy it.
Alex
update: Add link to explanation.
Also use V not L (see this) to force correct endianness - this should now work on mac's
and fixed a bug where it didn't work for 5.8.8


In reply to Let's go to the movies by teamster_jr

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 avoiding work at the Monastery: (7)
    As of 2014-12-27 12:37 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (177 votes), past polls