http://www.perlmonks.org?node_id=165069

Good day, monks,

A friend of mine sent me a link to a discussion of obfuscating code in C. In this particular discussion the programmer attacked a simple terminal application which produced a Mandelbrot fractal. It's a rather impressive bit of C coding (to a less than adept C coder), but I thought it would be fun to attack in Perl. (Note: I can't get the C code to compile on gcc, but I didn't try very hard.)

The C code example is 189 characters (my count with removed whitespace). I consider this more a golf than obfuscation since obfuscation implies a deliberate attempt to mislead the reader. The intent here was merely to make it as small as possible, and in the process it became difficult to read.

My code in Perl is 164 characters (less the shebang and newlines). This is my first official golf, so I'm sure someone out there will outdo me. I'd love to see it, and it might be fun to let the author of the C article see what madness we come up with.

#! /usr/bin/perl for(0..39){$i=-1+$_*.05;for(0..59){$r=$j=-2.3+$_*.05; $z=$i;$b=" ";for(0..255){$m=$r*$r;$n=$z*$z;if($m+$n>4) {$b="+";last}$z=2*$r*$z+$i;$r=$m-$n+$j}print$b}print"\n"}
This outputs a 60 column by 40 row graph of ' ' and '+' which gives a decent presentation of the Mandelbrot fractal. Read the original article for more information. It was tested on Solaris 2.8 with Perl 5.005_3 and 5.6.1, but should run anywhere.

Good luck!
{NULE}
--
http://www.nule.org

__END__ Output should be this: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++ ++ +++++++++++ +++++++++++++++++++++++++++++++++++ +++++++ ++++++++++++++++++++++++++++++++++++ +++++++ +++++++++++++++++++++++++++++++++++ ++++++++ ++++++++++++++++++++++++++++++++++ +++++++ +++++++++++++++++++++++++++++++++ +++++ +++++++++++++++++++++++++++++++++ ++++++ +++++++++++++++++++++++ + +++++ ++++++ +++++++++++++++++++++++ ++ ++++++ ++++++++++++++++++++++ + ++++++ ++++++++++++++++++++++ + ++++++ ++++++++++++++++++++ + + +++++++ ++++++ ++++++++ ++++++++++++++++++++ + + +++++++ ++++++++++++++++++++++ + ++++++ ++++++++++++++++++++++ + ++++++ +++++++++++++++++++++++ ++ ++++++ +++++++++++++++++++++++ + +++++ ++++++ +++++++++++++++++++++++++++++++++ ++++++ +++++++++++++++++++++++++++++++++ +++++ ++++++++++++++++++++++++++++++++++ +++++++ +++++++++++++++++++++++++++++++++++ ++++++++ ++++++++++++++++++++++++++++++++++++ +++++++ +++++++++++++++++++++++++++++++++++ +++++++ ++++++++++++++++++++++++++++++++++++ ++ +++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++ +++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++