The FizzBuzz problem is a simple coding demonstration to write an application in any language that counts from 1 to 100:

Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

I found the following on Stackprinter (deleted Stackoverflow questions) by  “ysth”; probably the best example of wicked-cool code obsfucation, ever.

(                       (
''))=~('('.'?'.'{'.("`"|
'%').('['^'-').('`'|'!').
('`'|',').'"'.('['^'+').(
         ((            (
         (             ((
         (             ((
         '['         ))))
          )))))^(')')).(
           '`'|")").(
         (              (
         '`'))|'.').('['^
         '/').'+'.('(').(
         '`'^'&').(('`')|
                     ((
                      ((
                    ')'))
                   ))).+(
                   "["^

         (              (
         '!'))).('['^'!')    .')'
         .'['.''.('$').    '_'.
         '%'.('^'^(('`')|     ((
         (              (
         '-')))))).(']').
         '.'.'('.('`'^'"'
         ).('['^'.').('['
                       ^
                       ((
                       ((
         '!'))))).(('[')^
         '!').')'.('[').
         ''.'$'.'_'
                        .
            '%'.('^'^('`'|'+'
         )).']'.'|'.'|'.''.
         '$'.'_'.','.''.'$'
         .+             (
         ((
           (
                  (
                  (
                  (
                  (
            '/')))))))).(
                  (
                  (
                  (
                   '`')))|
              '&').('`'|"/").(
           '['^')').('{'^'[').('^'
         ^('`'|'/'         )).".".
         ((                      '.'

         )                         )
         .                         (
         '^'^('`'|'/')).('^'^(('`')|
         '.')).('^'^('`'|'.')).('!'^
         (              (          (
         (              (          (
                        (          (
                        (          (
                       '+'         )
                      )))))        )
                                   )
                                  ))
                               ).'"'

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

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

                   ^'}';$
              ='`'|'!';$:=")"^
           '}';$~='*'|'`';$^="+"^
         ('_');$/=         '&'|'@';
         $,                      =((

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

         (
         (
         (
         (
         (
         (
         (
         (

         (                     ((
         '*')                ))  ))
            )))             )      )
               ))|          (      (
                   '`'       ));$^=
           '+'       ^((
         ((   ((        '_'
         )                  )))
         )     )              ;$/
          ='&'|                  '@'

          ;$,                    =
         '['                     &+
         ((                       ((
         (                         (
         (                         (
         (             ((          (
         '~'         ))))))      )))
         )));(    ($))  =','^"|";
          $:='.'^"~";    $~="@"|
            "(";$^=

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

          |+
         '`';
         ($^)

                   =('+')^
              '_';$/='&'|'@';$,
           ='['&'~';$=','^'|';$:=
         '.'^"~";         $~="@"|
         ((                      '('

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

         )));                   ($/)
         ='`'|'.';         $,="("^
           '}';$='`'|'!';$:=")"^
               '}';$~='*'|'`'

                   ;$^='+'
              ^'_';$/='&'|"@";
           $,='['&'~';$=','^"|";
         $:=('.')^         "~";$~=
         ((                      '@'

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

         (
         (
         (
         (
         (
         (
         (
         (

         (                     ((
         ',')                ))  ))
            )))             )      )
               ))^          (      (
                   '|'       ));$:=
           '.'       ^((
         ((   ((        '~'
         )                  )))
         )     )              ;$~
          ='@'|                  '('

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

         '_';                   ($/)
         ='&'|'@';         $,="["&
           '~';$=','^'|';$:="."^
               '~';$~='@'|'('

          ;(               ($^))=
         ')'^   '[';$/='`'|('.');$,=
         '('^      '}';$='`'|"!";

          $:               =")"^
         '}';   $~='*'|'`';$^=('+')^
         '_';      $/='&'|('@');$,=

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

         (
         (
         (
         (
         (
         (
         (
         (

          ((
         '+')
       ))))))

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

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

         =
         (                    (
         '@'))|'(';$^=')'^'[';$/=
         '`'|'.';$,='('^'}';$='`'
         |
         (
          ((
         '!')
         ));(

          $:
         )=((
         ')')

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

                  ('`');$^=
             '+'^'_';$/='&'|'@'
           ;$,='['&'~';$=','^'|'
          ;($:)               ='.'^
         ((                       ((
         (                         (
         (                         (
         ((                      '~'
          )))))               )))))
           ;$~='@'|'(';$^=')'^'['
              ;$/='`'|".";#;#

Save the above Asciiart into a file called, for example, fizz.pl.

Then run it: perl fizz.pl

Enhanced by Zemanta

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.