An example of an obfuscated Tcl program

I wrote this back in October of 1994 when the idea of an IOTCC (International Obfuscated Tcl Code Contest) was first suggested, but since the contest has never materialized, I've decided to go ahead and publish my entry.


#(*Y FF ?M$#@* Ydsu f98\425 ht pe\49$wuyr 87ewyt q43U985y 437y*&YF* E&Y\
@0)(*@# 87\32kj\\h df8 jvm*f &^t-c-l{:>? ~``akj'<f sdf} \236+|,3+!~=%@^%
r\145n\141\155\145 \162\e\156a\155e  @y{!;@\y{\!  \146\o\162\ma\164  ~&z
[~&z @%c\{! 121] p\162\157\c \%2\d;\@\y\173! f\157\162  4;\100y\173\!  [
\~\&z                 %s{\!              @\y]   f(x);f(x)  \~&\z  p\1362
f\50x) [p\^2   g\%c\o\45\s   108 ba\l ]   g%c   ;[\p\^\062  f\%c\x\051 \
40 ] s\e\164   +|q;+\174q   #j& \160\^2;f(x\)   [${#j&}  %\143n%s\162  \
105 \c ] b`=   ;# 8&dfjlw   {f98df 3% *} ()~X   &Yh<": [jP |`~! x4& Zj8t
\+|\161 z34$   [\p\136\62   n%s\li [[\53\174q   #\j\&  ]  \157%c\e\167 \
110]]\156e ;   \%2d ^\x$`   \  { \g\%\c '<:;4   {\53\174\161 \77 \062} {
${?} <[ \+|q   '<:]} {b`=   ?} { g\45c '${?};   +\174q '[ +|\161 ?] 1 }}
\146\50\x\51   f(x\) @\+/   ;+|q '<: 100;^x$`   ;@\53/ +|q i*T#; i*T#  \
`%(- 0; @\+/   ex\160\162   E)~'; i\52T# \F\d   [${#j&} \s\164d\%c\45\s\
\06111 \ut];   \100\53\57   \160\u\164s p\>+;   4 i*T#\ i\Y\&\^x\ \062 {
[i*\T# iY&^x   ]<${'<:}} {   b`= i\Y&^x   } {   i[\p\1362 %c 102] [i*T#\
'[\151\*\T\#   i\131\46^x]]              {p>+                -${z34$}  [
p^2 \ %5d [i*T# iY&^x]]; b`= `%(-;[p^2 i]f { [E)~' [i*T# `%(-]%12]==0} {
\160>+ "" } ;[E)~' 8/2] {i*T# j [E)~' 2*[i*\T# iY\&^\x]]} {$j < ${'<:}}\
{i*T# j [E\51~\47 $j+${iY&^x}] } { i*T# '$j 0} } }; \i\146 { [E\)\176' [
i\*T\# `%(-]%12]!=[\105)\176' t\141n(0\51]} {p\>\53 \0 };\145\170i\164 0

Can you figure out what it does?
An explanation will be coming soon...

You can also download a copy of the program and try it out.