Visually-Interlaced Mesmerizing Japh
liverpole
created: 2006-09-02 18:04:17
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 [id://567147|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,6Vf6FgxHF6f7BrBtxRSsRvvHxrBfFG7BRSwFBr2gwbCgyyyYXxP1q@pp@>^j
j:JJZZ0A?N^gG6FfvHHfvvrTsED2scFVFxX6v6FgwBBgwvrRvGG2Rf6XHyIxhQ1@P,:*:Z
j</_W6VFvXh88DcsEDbswvVvGI4tfgWFrBww6BbwWgbsvFF0q9XxE=lLZ::*j
*%%jJ*:Zk[Jj+K?G6FvV6FcsCBbryyVvFF7Sc7GfFRBvwgC3F_w2bw77?=,Td4MM+:jZJ*
:L,**:Zj:;[jjjKkCC7wgGSCrBbgyhF6FfvBBfvvvSsFF6Rb.NFvFrbR*:L4D,.Og8XDd>.JZ*J:
j6Hhhvww@`.;]t2BrN*:j%PN:%L*::*TDBR%,*BdtBB[kllJmEB2RZlL:jjZZRBrJ:j:n^NN:ZJ*:
:,L::JZ,,>_k;;]pnkKlA?/QXrRBmQ_/0Dbw7cm-6IE2C??q`^::+ooSwvN;;.o__JJ*:j
Z,;[jj%l3wVS_pLj*M=:.o3Hxb3u8^Zl=m.?K:n>BcCJ+;jFFrbjZZ:
J*;k^n``gg6;?PZjj[o.;_nJJbswfk_nJJ*;cr6gs6.:C3v.**;]jK[rFH4BZj;=%nnjRtDB*
r22RBrBrC7>ZZjko>[/FbrRcw>:;?.:kK>j>?k:j>O+<^^jmm:^cshxdL+:]=@XVFTdtTj
BBrBrrRbbwwCCkk/.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$..$/
Re: Visually-Interlaced Mesmerizing Japh
created: 2006-09-05 10:58:23
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
created: 2006-09-05 12:04:24
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)
imp
created: 2006-09-06 00:22:57
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<=@%`adehilmpqtuxy-]","[/.016-9>?@^_`af-in-qv-y]","[2-9b-ir-y]","John C. Norton '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?
created: 2006-09-08 07:35:57
I see a camel in the code itself.

perlmonks.org content © perlmonks.org and Anonymous Monk, imp, liverpole, SubStack, wulvrine

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03