Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

This started as a test script while I was learning about bit operations, and it slowly evolved into an obfuscated JAPH. I know it exceeds the traditional "4 line rule", but I thought that it would be fun to limit the digits used to only 0 and 1, given the theme. It was not golfed in any way.


$_=[[[[{},[]],{0111,'01110111',1000,'11100101'},[[]]],{0001,'01111110' ,0110,'00011010',0100,'011001000011111001111010',0010,'00000100',0011, '01010101000100000001111110100010101000000000101000110000010001001010' .'10100',0101,'011100001001010100000001'},[[]]]];%_=%{${${$_}[0]}[1]}; $s=eval{$O=0,$C=0,$t='This is my 100th PM post';sub{$O++,$C=@_?$C:eval pack('b*',vec(pack('b*',$_{1<<(1<<0<<1)*((1<<0+1<<0)+1<<0)}),$O-1,1<<0 )?$_{1<<0}:$_{1<<(1<<1<<1)-1}).$C.pack('c',vec(pack('b*',$_{1<<((1<<0) +(1<<1*1<<1)+1<<0)}),($O-1)%((1<<0*1<<1)+1<<0),1<<(1<<0+1<<0)+1)).pack ('b*',vec(pack('b*',$_{1<<((1<<0+1<<0)+(1<<1<<1))}),$O-1,1)?$_{1<<((1+ 1<<0)+1)}:$_{1<<0}).vec($t,$O-1,1<<(1<<1<<1)-(1<<0))};};;$o=pack('b*', $_{((1<<1)**(1<<1)-1)**(1<<1)});for(0..unpack('%b*',$o)-(1<<1)){$c=$_- (($_-$_%(1<<1<<1))/(1<<1<<0*1<<1)+($_%(1<<1+1<<0)?1:0));;$i=(vec($o,$c ,(1<<1<<0+1<<0))+(vec($o,$c+1,(1<<1<<1))<<(1<<1<<0+1))>>((1<<1<<1<<1>> 1)-$_%(1<<1<<1<<1>>1)-(1<<1<<0+1)*($_%(1<<1<<1>>1<<1)?0:1)));$i+=$i%(1 <<1)?-1:1 if((($_+1)%((1<<1+1<<1)+(1<<1)+(1<<1)))&&!(($_+1)%((1<<1)**( 1<<1)-1))||$_+1==(1<<(1<<1+1<<1>>1))+(((1<<1)+1)<<1));$T=vec(pack('C', $i),0,(1<<1<<1>>1<<1))+vec(pack('b*',$_{(1+((1<<1)**(1<<1))**((1<<1)** (1<<1)-1))}),$_,1)*(1<<(1<<(1<<1)))+(1<<((1<<1**1<<1)+1));;print pack( 'c',($T+=$T==(1<<((1<<1+1<<1>>1)+1))?0:(1<<(((1<<1+1<<1)>>1)+(1<<0*1<< 1))))-=$_%(1+(((1<<1+1<<1)>>1)+(1<<0*1<<1)<<1))==0?(1<<(((1<<1*1<<1<<1 )+(1<<1<<1>>1))>>1)):0);&$s}print pack('c',$s->(1<<0)^unpack('c',(pack ('b*',$_{(1<<1*1<<1*1<<1)*((1<<1)**(1<<0<<1)-1)**(1<<1<<1>>1<<0)}))));


Hint: the bit shifts are fun, but they aren't the main point of the obfuscation.

Tested on

  • perl 5.005_03 built for i386-linux (little endian)
  • perl 5.6.0 built for sun4-solaris (big endian)
  • perl 5.6.1 built for MSWin32-x86-multi-thread (little endian)
  • perl 5.8.0 built for i386-linux-thread-multi (little endian)
  • perl 5.8.3 built for i686-linux (little endian)
  • perl 5.8.4 built for i386-linux-thread-multi (little endian)

In reply to Bits & pieces by bobf

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    [stevieb]: hahaha! Some days I wish I could quit after learning one new thing. Often that happens before I'm one my first coffee ;)
    [MidLifeXis]: OHHHH. Mea culpa - I read that as coderef (facepalm)
    [stevieb]: mlx: That's easy to have done in that context. For those who don't know, it converts itself into the current sub name, much like __PACKAGE__ translates into the current package name (or class)
    [LanX]: ref! not name

    How do I use this? | Other CB clients
    Other Users?
    Others wandering the Monastery: (13)
    As of 2017-05-24 17:34 GMT
    Find Nodes?
      Voting Booth?