Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Visually-Interlaced Mesmerizing Japh

by liverpole (Monsignor)
on Sep 02, 2006 at 22:04 UTC ( #570893=obfuscated: print w/ replies, xml ) Need Help??

This Japh needs gvim 7.0 installed.  (Note that it has to be version 7.0; earlier versions won't support the scripting commands used).

When I wrote this Japh, I didn't know any vim-scripting, so I had to take a more basic approach.  Shortly afterwards I devised the algorithm for this one, and thought if I could learn enough vim scripting commands, it shouldn't take more than a couple of days to program.  Surprisingly, it took a lot longer than expected, but partly because, as it evolved, I kept wanting to get it "just right".  One challenge was "golfing" the vim script to make it all fit into the Japh.  (If you know any vim commands, you'll see a lot of command abbreviations :-D).

It's been tested on both Windows and Linux.  When you get tired of watching it run, just type ^C to stop.  It does create a temp file "v.tmp" which can be deleted afterwards.  If there's any interest, I may also provide the "meta-program" which generates the Japh.  Of course, it would be fun to see if anyone can figure out the mechanics of how it works first.

s''::jjJjJ:rBBRscCC[kkKjj:JjJ*>>NN>NnFvvV2brrrBb:JZ::jj**:ZJ::JJJ*::jj Jj::JBTtTDT4=[sR2rRRr*[k;ZnNn>>.>Dus37GG7GGW7BbrBBZjjjJj::*JjjJ:jZJjZZ *::JbRtddDeUuDbBBr2BrRFnoO/>N.^VB4UCWWGwWWGggffv6brJZjjl,<j*Zk;,l<Jj:j jJ:jRbtd2scSrdtCbbhhHid*:<Q?`Phb2DDVfVvggFFfVFvFFvVV6*L,<L,lJ=-L<%L:jJ JJ:J*Zdtcs2brdiwwx8Vw9el:<xIYxT2rTHvVvvg7vfgwfvFfggfFii1A=L<]M]]-<<LZJ j:j*:Zl=m<@xXX7WIhfVG7UT2TXFWSRbbXhfffhyix8y98Fffw7fwIhHh`qP@m]<<%%lZj ZZ:ZZ*@AQ@hXhf7GIXhXyIudBdhVC3brFHhbr6fwWRBgcrbvfcCbg9HHXH`P`a1@@LLlJj :jn.Nn@a?>6Vf6FgxHF6f7BrBtxRSsRvvHxrBfFG7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bbwwCCkk/.KCV6FfwO^jZkoO_nJj^nkk;J?OZ<@Pq/>jZ;o1]k:RCE4FfbbtL:: *ZZ*BBRrRbrBrBB*::jjJjZZ*::J::*ZZ*::J::j:j:ZZ*::J::J:Rr2BbBBbr2jZjJj:Z ';s!$/!!g;s!%!\\!g;sub l{int((-42+ord pop)/16)}while(s/(.)(.)(.)//){$" .=chr(2+5*(5*l($1)+l$2)+l$3)}eval$"#liverpole~Just+another+Perl+hacker

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

Comment on Visually-Interlaced Mesmerizing Japh
Download Code
Re: Visually-Interlaced Mesmerizing Japh
by wulvrine (Friar) on Sep 05, 2006 at 14:58 UTC
    Pretty darn cool. I don't know VI very well and script at all, so not even trying to decipher this :) But definately enjoyed watching it!
    Purdy colors! ++

    s&&VALKYRIE &&& print $_^q|!4 =+;' *|
Re: Visually-Interlaced Mesmerizing Japh
by SubStack (Monk) on Sep 05, 2006 at 16:04 UTC
    This is one of the most colorful japhs I've seen. I'll be taking a close look at this one later to see how you managed to pack so much information in only a page full of text.
    ++Excellent work!
Re: Visually-Interlaced Mesmerizing Japh (Mini Spoiler)
by imp (Priest) on Sep 06, 2006 at 04:22 UTC
    I haven't finished exploring the encoding mechanism, but here's a basic summary.

    Each group of 3 characters is used in the creation of one output character. The character code is generated by summing the following:

    chr( 5 * ( 5 * l($char1) +l($char2) ) + l($char3) + 2 )
    Where 'l' is a subroutine that does:
    int ( ord($char) - 42) / 16
    Here is the translation for the first 11 sets:
    [::j] chr(2+5*(5*l(:)+l(:))+l(j)) = chr(5*(5*1+1)+4+2) = $ [jJj] chr(2+5*(5*l(j)+l(J))+l(j)) = chr(5*(5*4+2)+4+2) = t [J:r] chr(2+5*(5*l(J)+l(:))+l(r)) = chr(5*(5*2+1)+4+2) = = [BBR] chr(2+5*(5*l(B)+l(B))+l(R)) = chr(5*(5*1+1)+2+2) = " [scC] chr(2+5*(5*l(s)+l(c))+l(C)) = chr(5*(5*4+3)+1+2) = v [C[k] chr(2+5*(5*l(C)+l([))+l(k)) = chr(5*(5*1+3)+4+2) = . [kKj] chr(2+5*(5*l(k)+l(K))+l(j)) = chr(5*(5*4+2)+4+2) = t [j:J] chr(2+5*(5*l(j)+l(:))+l(J)) = chr(5*(5*4+1)+2+2) = m [jJ*] chr(2+5*(5*l(j)+l(J))+l(*)) = chr(5*(5*4+2)+0+2) = p [>>N] chr(2+5*(5*l(>)+l(>))+l(N)) = chr(5*(5*1+1)+2+2) = " [N>N] chr(2+5*(5*l(N)+l(>))+l(N)) = chr(5*(5*2+1)+2+2) = ;
    Which yields:
    $t = "v.tmp";
    This encoding gives a great deal of flexibility in the characters used, as every column is divided by 16 before it is touched by the decoder.

    The resulting perl script is as follows:

    $t="v.tmp";open($f,">$t"); print $f " let L=[\"[][+/13579;=?_acegikmoqsuwy-]\",\"[],014589<=@%`adehilmpqtuxy +-]\",\"[/.016-9>?@^_`af-in-qv-y]\",\"[2-9b-ir-y]\",\"John C. Norton ' +liverpole'\"] let v=8 let C=255 let W=C let x=3 se hls ic wh 1 let C+=v if C>254 let v=-v let C=255 let x=(x+1)%4 let y=L[x] let f=1 elsei C<1 let C=0 let v=-v en go 1 let R=x%2?W :C let G=x==2?W :C let B=C if !x || x>2 let B=W en exe printf(\"hi Search guibg=#%02x%02x%02x\",R,G,B) exe \"/\".y redr if f sl let f=0 en sl 100m endw ";close$f; system("gvim -c \"so $t\" \"$0\"") #jcn
    Which basically writes a temp file containining vimscript, then opens the perl script in vim, and sources the newly created vimscript - which is as follows (with variables renamed and indentation added to make it easier to follow):
    let search_patterns=["[][+/13579;=?_acegikmoqsuwy-]","[],014589<=@%`ad +ehilmpqtuxy-]","[/.016-9>?@^_`af-in-qv-y]","[2-9b-ir-y]","John C. Nor +ton 'liverpole'"] let vector=8 let C=255 let n_pattern=3 set hlsearch ignorecase while 1 let C+=vector if C > 254 let vector = -vector let C=255 let n_pattern=(n_pattern+1)%4 let pattern = search_patterns[n_pattern] exe "/".pattern let f=1 elsei C<1 let C=0 let vector=-vector end goto 1 let red = n_pattern % 2 ? 255 : C let green = n_pattern == 2 ? 255 : C let blue = C if !n_pattern || n_pattern > 2 let blue = 255 end exe printf("hi Search guibg=#%02x%02x%02x",red,green,blue) redraw if f sleep let f=0 end sleep 100m endwhile
Is that a camel I see?
by Anonymous Monk on Sep 08, 2006 at 11:35 UTC
    I see a camel in the code itself.
Re: Visually-Interlaced Mesmerizing Japh
by addinall (Novice) on Apr 26, 2007 at 06:13 UTC
    Brilliant! Absolutely brilliant! addinall.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2014-08-22 00:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (145 votes), past polls