Thankyou to Dave and Jerome for running the game and for
their invitation to explain some of my weird entries.

The fwp old-hands may have yawned at my 7918-stroke entry,
but I hope it caused at least a few fwp newbies to remark
"What the hell is that?" or "How the hell does that work?".

Let me start at the beginning.

About six months ago, as a fwp beginner, I used to provoke
the fwp maestros with outrageous statements like:
"It is impossible to write a JAPH that writes to stdout
 without using at least one alphanumeric character."
http:[EMAIL PROTECTED]/msg00218.html

Ronald J Kimball happened to take that bait and responded with:
http:[EMAIL PROTECTED]/msg00221.html

Around that time, I was also profoundly impressed with this
post by Japhy:
http:[EMAIL PROTECTED]/msg00158.html

Not to mention falling on the floor laughing at Damian Conway's
Acme::Bleach module. Plus, I was looking to improve my Perl
skills, and therefore eager to write a CPAN module.

Having seen some camel-shaped JAPHs, and Acme::Bleach and
Acme::Smirch, I realised that I could generalise Ronald's and
Japhy's posts to produce a module that converted any program
into any shape! All I needed was an encoding scheme to convert
ASCII to 'sightly' and back again, where 'sightly' is defined
as the following 32 characters:
    ! " # $ % & ' ( ) * + , - . /            (33-47)
    : ; < = > ? @                            (58-64)
    [ \ ] ^ _ `                              (91-96)
    { | } ~                                  (123-126)
I call it 'sightly' because it lacks any unsightly letters
or numbers.

Essentially, each alphanumeric character can be produced by a
bit operation between two sightly characters. For example,
the letter 'A' can be produced with: '`'^'!'. Now, if you can
produce every alphanumeric in this way, you can join them into
a string with the '.' operator, then eval that string. Now,
since a program is just a string, the problem is solved.

There is one annoyance, however: 'eval' itself is four unsightly
alphabetic characters. What to do? The answer lies in Japhy's
post: use ''=~ in harness with (?{...}) to eval the code inside
a regular expression. What I did not know at the time, however,
is that Perl's regex engine is not re-entrant, so there are
some limitations to this approach (discussed further below).

Thus was born Acme::EyeDrops:
http://search.cpan.org/search?dist=Acme-EyeDrops

Lacking the natural bit twiddling abilities of a Keith Ivey,
I wrote several brute force programs to find all the required
bit operations for the ascii-to-sightly encoding. The interested
reader can find the details of the encoding scheme in the first
page of EyeDrops.pm (ascii_to_sightly/sightly_to_ascii functions).

As it turns out, the encoding scheme is only about 100 lines
of code, while the shape-pouring code is much longer. To pour
into a shape exactly, some heuristics are needed, such as
converting '`' to "\`" to increase the length by one to fit.

As pointed out in the EyeDrops documentation, you can convert
even quite complex programs -- but at the cost of a leading
unsightly eval.

For the TPR solution, however, I did not want an unsightly eval,
so my first task was to solve the problem without using $_ and
without using regular expressions. After a while, I came up with
k.pl:

$y=pop;$r+=(ord$x>60?-55+ord$x:$x)*36**$f++while(($x=chop$y)ne"");
print$r.$/

Now, this is not optimal, but it does not need to be because it
is to be poured into a giant banner of "The Perl Review", which
I did on a Linux box (need the Linux banner command) as follows:

cd Acme-EyeDrops-1.05/demo
../sightly.pl -r -f k.pl -s banner -c "The Perl Review" -w 70 >n.pl

producing:


                                        ''=~("\(".
                                        '?'."\{".(
                                        '`'|'%').(
                                             "\["^
                                               '-'
                                                ).
                                                +(
 '`'                                            |+
 '!'                                            ).
 (((                                            ((
 '`'))))|',').'"'.'\\'.'$'.('['^'"').'='.('['^'+')
 .('`'|'/').('['^'+').';'.'\\'.'$'.('['^')')."\+".
 '='.'('.('`'|'/').('['^')').('`'|'$').'\\'."\$".(
 '['^'#').'>'.('^'^('`'|'(')).('^'^('`'|'.')).'?'.
 '-'                                            .(
 '^'                                            ^(
                                                ((
                                                ((
                                                ((
                                               '`'
                                             )))))
                                        )|"\+")).(
                                        '^'^("\`"|

 '+'                                            ))
 .((                                            ((
 '+')))).('`'|'/').('['^')').('`'|'$').'\\'."\$".(
 '['^'#').':'.'\\'.'$'.('['^'#').')'.'*'.('^'^('`'
 |'-')).('^'^('`'|'(')).'*'.'*'.'\\'.'$'.('`'|'&')
 .'+'.'+'.('['^',').('`'|'(').('`'|')').('`'|',').
 (((                     ((
                          ((
                          '`')
                          ))))
                          )|((
 '%'                     ))).+
 '('.'('.'\\'.'$'.('['^('#')).
 '='.('`'|'#').('`'|'(').('`'|
 '/').('['^'+').'\\'.('$').(
 '['^'"').')'.('`'|"\.").(
 '`'

           |'%').''.
        '\\'."\"".'\\'.
      '"'.')'.';'.(('[')^
    '+').('['^')').('`'|')'
   ).('`'|     ((     '.')))
  .''.         +(        '['^
  '/'          ).          (((
 (((           ((           ((
 (((           ((           ((
 (((           ((           ((
  ((           ((          (((
  ((           ((        '\\'
   ))          ))     ))))))
    )))        ))))))))))))
      ))       )))))))).+
               '$'.('['




















 ^((                                            ((
 ')'                                            ))
 )))                                            .+
 '.'.'\\'.'$'.'/'.('!'^'+').'"'.'}'.')');$:=('.')^
 '~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^"\}";
 $,='`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|('(');$^=
 ')'^'[';$/='`'|'.';$_='('^'}';$,='`'|'!';$\="\)"^
 '}'                        ;(                  $:
 )=(                        ((                  ((
 '.'                        ))                  ))
                            )^                  ((
                            ((                  ((
                            ((                  ((
                            '~'                )))
                            )))               ))))
                            ;$~=              '@'
                            |'(';           ($^)=
                             ')'^'['      ;$/='`'
                              |'.';$_='('^'}';$,
                               ='`'|'!';$\=')'^
                                '}';$:=('.')^
                                   "\~";$~=

           '@'|"\(";
        $^=')'^"\[";$/=
      '`'|'.';$_='('^'}';
    $,='`'|'!';$\=')'^"\}";
   $:='.'^     ((     '~'));
  ($~)         =(        '@')
  |((          ((          '('
 )))           );           $^
 =((           ((           ((
 ')'           ))           ))
  ))           ^+          '['
  ;(           $/        )=((
   ((          ((     '`')))
    )))        |'.';$_='('^
      ((       "\}"));$,=
               '`'|'!';

 $\=                        ((
 ')'                        ))
 ^'}';$:='.'^'~';$~='@'|'(';$^
 =')'^'[';$/='`'|'.';$_=('(')^
 '}';$,='`'|'!';$\=')'^'}';$:=
 '.'^'~';$~='@'|'(';$^=')'^'['
 ;$/                   =((
                        '`'
                         ))|
                         '.';
                         ($_)=
                     '('^"\}";
                    $,='`'|'!'
                    ;$\=(')')^
                    ('}');$:=
                      '.'^
 '~'                                            ;(
 $~)                                            =(
 '@')|'(';$^=')'^'[';$/='`'|'.';$_='('^'}';$,='`'|
 '!';$\=')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^"\[";
 $/='`'|'.';$_='('^'}';$,='`'|'!';$\=')'^('}');$:=
 '.'^'~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_="\("^
 '}'



















 ;$,                                            =(
 '`'                                            )|
 '!'                                            ;(
 $\)=')'^'}';$:='.'^'~';$~='@'|'(';$^=')'^"\[";$/=
 '`'|'.';$_='('^'}';$,='`'|'!';$\=')'^'}';$:="\."^
 '~';$~='@'|'(';$^=')'^'[';$/='`'|'.';$_='('^"\}";
 $,='`'|'!';$\=')'^'}';$:='.'^'~';$~='@'|('(');$^=
 ')'                      ^'['                  ;(
 $/)                   =('`')|                  ((
 '.'                 ));$_='('                  ^+
                  '}';$,="\`"|                  ((
               '!'));$\=(')')^                  ((
            '}'));$:='.'^"\~";                  $~
 =((     '@'))|'(';$^=')'   ^((                '['
 ));  $/='`'|('.');$_=      '('               ^'}'
 ;$,='`'|'!';$\=')'         ^'}'              ;$:
 ='.'^'~';$~='@'            |'(';           ($^)=
 ')'^"\[";$/=                '`'|'.'      ;$_='('
 ^('}');$,=                   '`'|'!';$\=')'^'}'
 ;$:='.'                       ^'~';$~='@'|'(';
 ($^)=                          ')'^('[');$/=
 '`'                               |'.';$_=
 '('

           ^"\}";$,=
        '`'|'!';$\=')'^
      '}';$:='.'^"\~";$~=
    '@'|'(';$^=')'^"\[";$/=
   '`'|'.'     ;(     ($_))=
  '('^         ((        '}')
  );(          $,          )=(
 '`'           )|           ((
 '!'           ))           ;(
 $\)           =(           ((
  ((           ((          ')'
  ))           ))        )))^
   ((          ((     '}')))
    );(        $:)='.'^'~';
      $~       ='@'|"\(";
               $^="\)"^

                            ((
                            ((
                         '['))
                    ));$/='`'|
                 '.';$_=('(')^
             '}';$,='`'|'!';$\
         =')'^'}';$:="\."^  ((
     '~'));$~='@'|'(';
 $^=')'^'[';$/='`'
   |'.';$_="\("^
       '}';$,
           ="\`"|
               '!';$\=
                   ')'^'}'  ;(
                       $:)='.'
                           ^((
                            ((

 '~'                        ))
 ));                        $~         =((
 '@'))|'(';$^=')'^'[';$/="\`"|       '.';$_
 ='('^'}';$,='`'|'!';$\=(')')^      "\}";$:=
 '.'^'~';$~='@'|'(';$^=')'^'['       ;($/)=
 '`'|'.';$_='('^'}';$,='`'|'!'         ;$\
 =((
           ')'))^'}'
        ;$:='.'^'~';$~=
      '@'|'(';$^=')'^'[';
    $/='`'|'.';$_='('^"\}";
   $,='`'|     ((     '!'));
  ($\)         =(        ')')
  ^((          ((          '}'
 )))           );           $:
 =((           ((           ((
 '.'           ))           ))
  ))           ^+          '~'
  ;(           $~        )=((
   ((          ((     '@')))
    )))        |'(';$^=')'^
      ((       "\["));$/=
               '`'|'.';

                            $_
                            =(
                         '(')^
                    '}';$,='`'
                 |'!';$\="\)"^
             '}';$:='.'^'~';$~
         ='@'|'(';$^="\)"^  ((
     '['));$/='`'|'.';
 $_='('^'}';$,='`'
   |'!';$\="\)"^
       '}';$:
          =('.')^
       '~';$~='@'|'(';
  $^=')'^'[';$/='`'
   |'.';$_="\("^
       '}';$,
           ="\`"|
               '!';$\=
                 ')'^'}'    ;(
                     $:)="\."^
                         "\~";
                            #;
                            #;


/-\ndrew

Reply via email to