Huffman Coding

… with a bunch of Family Stuff too

IOCCC Award

The “C” Language is known for its susceptibility to eccentric implementations. With too much creativity, code can be nearly impossible to read or maintain. Decades ago, a few programmers created the International Obfuscated C Code Contest to reward those who can abuse it capabilities with flair. It is held over the Internet each year and it is to software engineers as a bad Hemmingway Contest would be to novelists.

My professional career unfortunately peaked last century when I entered the 13th annual contest for the first time and won an award for the “Best Obfuscated Character Set Utility.” It was presented January 9, 1997 at the USENIX 1997 Annual Technical Conference.

The program takes regular text as input and converts it to Braille with asterisks (*) as output. Additionally, when you give it Braille, it converts it back to regular text. Oh yeah, one more thing, the program also is written in Braille so when you feed the source code into itself, it displays the instructions on what the program does.Some guy from Sweden won the Best of Show. I think he was on steroids.For those who wish to look at this horrid “C” code, here it is:

#define x char
#define z else
#define w gets
#define r if
#define u int
#define s main
#define v putchar
#define y while
#define t " A?B?K?L?CIF?MSP?E?H?O?R?DJG?NTQ?????U?V?????X???????Z????W??Y??"
 s (   )  {   x* c  ,  b[ 5  * 72   ]; u  a, e  ,  d   [  9
*9 *9 ]  ;    y  (w  ( b) ){            r  ( 0   [ b] -7 *
5        )    {  c  =     b    ;       y  (  (*    c  -  6
* 7 )* *  c )c =  c+ 1  ;   r ((   -0 )  [ c  ] &&  w (  b   +
  8 *  5*    3        ) && w          (b   +8      *5  * 6) )
  { a       =  0; y     (                  a       [     b  ]
 ) {    a [  d  ] = ! !    ( a[ b]   -   4 *8 )    ;  a  =   a +
1;  }   y (a   <  8 *  5      *  3   )  d      [   (   a ++ )
]  =      0       ; a        =       0;            y(    b  [
 a +  8  *3   *  5  ] )  {   d  [ a  ]   = a  [    d] +  !  !( b[
a+ 40  *  3     ]  -4  * 8) *  2    ;      ++  a   ;   }     a  =
 0       ;      y  (     a     [  b +      6          *  40 ]
)  {a [d ]  +=  !   !  ( b[ a   +    5 *  6  *    8  ] - 4   *
 8        ) *  4;   a =   a  + 1    ;} a=   0;   y  (a   <3 *8
   *5       )  {    r    (     a    [       d    ]  )    {  e
 =  1  ; y    (   e[ a  +  d] ){    *  ( d+ a+    e )   = a[ d
+e -  1] +(       d   [     a  +   e  ]  <<  (   3* e) )     ;e
 =    e           +  1  ;} a       =        a     +
e -  1     ; v( !! (  *  (  d+
  a)  %   (  64  )  - 12  *  5
  )             +  (  e
>  4   ) ?t [   e   >2 ?  2  :a    [ d   ]  ]   :6 *  8  +( t  [ d[
 a    ]/ 8     /8   ]  -4  )      %( 10 )  )    ;  r(  ! (2 [a
+  d] +  3  [d +       a  ]  )    )        v    (  4  *     8    )
 ;  }    a =   a  + 1 ; } v    (5 *  2     )  ;  }    z {c =b ;   e
=  0    ;     y  (*   c )  {   *   c +=   -  (* c    >   8 *     12
   )    *  32    ;      a         =  8       *  8       ;  r  (* c
 >=  48  &&*  c<8  *8   -6)  {*c  =(   * c  + 1
 )   %(  5    * 2  ) +  65   ;y(  --a  >0   &&*
c-  a[  t]   );   d[   (e   ++   )]   =4   ;(
 * (  d +  (e   ++)  ))=  07   ;}z  y(a  --  >1
 &&*  c-   t[a  ]);  d[   ( e  = e  +    1)  -
1]   =a   %8   ;y   (a   /=   8)   d[   (e  ++
 ) ]  =    a% 8   ; ++ c   ; *  (   e ++   +d )  =0
;} --  e   ;r    (         e >0  ) {a  =   1   ;
y          (  a<       8     )  {   c =       b  ;y
 ( c  <e +b  )   {  v  (  *     ( c  -    b + d  )&   a? 6  *7
:8       *  4     ) ;   c ++   ;} a=  a   +    a  ;    v  ( 2*
   5) ;  }  v    (  5*    2    )          ;   }} }}      }