Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Alphabet Blocks Japh

by liverpole (Monsignor)
on Oct 03, 2007 at 04:00 UTC ( #642298=obfuscated: print w/ replies, xml ) Need Help??

Tested under both Linux and Windows.

When you run this with any argument, for example:

% perl blocks x

the program simply displays itself using all '#' characters (which makes it easier to read the letters depicted in the blocks in the ascii picture).

When run without arguments, the output gets REALLY interesting!

Warning -- this program is fairly memory intensive, so it's not recommended that you run it on a system with lots of other processes running concurrently.

Update:  Note, too, that the program creates/overwrites a file called 'x' in the current directory.  (Thanks shmem!)

Update 2:  Also note (especially for Linux users) that the Tk module must be installed.

Update 3:  A hint about deconstructing the program is this -- try running Deparse on the temporary file "x" which is created:  perl -MO=Deparse x

if(pop){undef$/;open$x,$0;$_=<$x>;s/\S/#/g;die$_} s'' useQTk; P($M=newQMa inWindow);$M->g eometry("0x0");subQ J{sprintf"#%02x%02x%02 x",randQ256,randQ256,r a ndQ256}subQA{$m->geome tr y(sprintf"%dx%d+%d+ %d" ,$ s,$s,$x-$s/2,$y -$s/ 2)}su bQP{$_[0]-> overr ideredir ect(1)} subQH{ ($G,$H,$I)= ($_ [0]->ge ometr y=~/( \d+)\+(. +)\+ (.+)/ );($H+$G /2, $I+ $G/2 )}subQ_{ @C= (J,J, J,J )}_;$A=p op; $M- >af ter(50, sub {m ap{ ($o,$p )=/ 4|5/? (7* $_-27 ,1) : (2+((ord) -54 )/7, 1+((ord )-54 )%7);$ J.= "#" x$o. $"x$ p}split //, q[5 77 EUE7 7ER76 KL576RTR77E R76KV 8 7678 :76 =67887 697:877;:76=678 87 697: 878@ :RR788 REV87:8:RR788REP87; 7:76 6= 788 769F 7 87687:766=78876967UEZ: 7677 G876K 77H FM :7677G876K88SKM<78GE96 K PYKS<77SR87KV86977< 777 7847897:86977<7777:699 7: YE S<SS:HEVSEM<SS: HEP; 9G<7777:699J;968<77 778 47896 ;;K77N7777R 87K7: ;K 86N7778E96K86]; ($s, $d)=($A% 2)?(37, -8):(4 ,3);w hile($q=sub str$J ,0, 80,"") {++ $r;$j=0 ;_QifQ$A >1;map{ $x=30+ 12* ++$j;$y=1 2*(11+$r +2* ($r>10 )); if(!/Q/ ){P ($m=$M->Top level);_ Qif $A>3;$m ->config ure (-hi ghl ightt=>1 ,-hig hlightb =>"black ",- bg =>$ C[($j<31 )+2*($ r<11) ]);push@ A,$ m; &A} }split/ /,$q;$ m ->u pdate}wh ile (13! =$s ){$s+= $d ;@ B= @A; while(@ B){ $_=spl ice @B,ra nd @ B,1,(); ($m,$s ,$x,$y)=( $_, $s,H ($_ ));&A;$ _->up date}} sle epQ 3;ma p{$b=sp lice @A, ran d@ A,1,();$b-> wit hdraw } @A;exit} ); Ma inLoo p ';s /\s//gx; s/Q/$"/gx; open$X,">x"; print $X $_; map{ system( "perl x $_ ")} 0..5

s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/

Comment on Alphabet Blocks Japh
Select or Download Code
Re: Alphabet Blocks Japh
by chargrill (Parson) on Oct 03, 2007 at 09:49 UTC

    Beautiful! ++liverpole!

    P.S. Also works on Mac OS X w/ X11


    --chargrill
    s**lil*; $*=join'',sort split q**; s;.*;grr; &&s+(.(.)).+$2$1+; $; = qq-$_-;s,.*,ahc,;$,.=chop for split q,,,reverse;print for($,,$;,$*,$/)
Re: Alphabet Blocks Japh (run in /tmp)
by shmem (Canon) on Oct 03, 2007 at 10:02 UTC
    Nice work, ++liverpole.

    But you should have mentioned what your code also does: it creates (and ocassionally overwrites) a file named x in the current directory (and doesn't clean up later).

    I have files called x, they are mostly q&d hacks, but the one which lives in ~/bin is an xterm dispatching menu written in perl Tk...

    Although it is easy to spot in your program (the call to open is in the dot), I found it worth mentioning that it should be run in a temporary folder.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: Alphabet Blocks Japh
by zentara (Archbishop) on Oct 03, 2007 at 16:04 UTC
    I wish they could harness your talents to solve world problems. ;-)++

    I'm not really a human, but I play one on earth. Cogito ergo sum a bum
      But no one would be able to comprehend the solutions!! ;-)
Re: Alphabet Blocks Japh
by kyle (Abbot) on Oct 03, 2007 at 16:36 UTC

    For a tiny extra bit of obscurity, you could change this:

    open$x,$0;$_=<$x>

    ...to this:

    open+0;$_=<0>
Re: Alphabet Blocks Japh
by wulvrine (Friar) on Oct 04, 2007 at 13:06 UTC
    Simply stunning, most definitely a ++!!
    You never cease to amaze and bewilder me, awesome job as aways!

    s&&VALKYRIE &&& print $_^q|!4 =+;' *|
Re: Alphabet Blocks Japh
by m0ve (Scribe) on Oct 05, 2007 at 09:15 UTC
    really nice work , ++
Re: Alphabet Blocks Japh
by codeacrobat (Chaplain) on Oct 13, 2007 at 16:18 UTC
    Divine perl magic, ++liverpole
    *must find out how it workz*

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: obfuscated [id://642298]
Approved by GrandFather
Front-paged by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2014-12-19 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (81 votes), past polls