Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Visually-Interlaced Mesmerizing Japh (Mini Spoiler)

by imp (Priest)
on Sep 06, 2006 at 04:22 UTC ( [id://571370]=note: print w/replies, xml ) Need Help??


in reply to Visually-Interlaced Mesmerizing Japh

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://571370]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-04-25 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found