in reply to Re: Re: (Golf) Mandelbrot Fractal
in thread (Golf) Mandelbrot Fractal

That use of $; is very clever, as it parses correctly and allows you to omit the brackets for the for. Combining this with other modifications yields 122 chars of obfuscated goodness:
print map{$i=$_/20;$/,map{$r=$;=$_/20;$z=$i;$n=$z*$z,$z=2*$r*$z+$i,$r=($m=$r*$r)-$n+$;for a..z;$m<4?$":"+"}-46..13}-20..19
Further savings if you choose 'X' instead of '+':
print map{$i=$_/20;$/,map{$r=$;=$_/20;$z=$i;$n=$z*$z,$z=2*$r*$z+$i,$r=($m=$r*$r)-$n+$;for a..z;$m<4?$":X}-46..13}-20..19
Here is the original C code, just for comparison, at 182 characters:
void main(){double O,x,o,I,l,i;char _;for(l=-1;l<1;l+=.05,putc ;i<.7;i+=.05,putchar(_?'?':':'),O=i,x=l,o=I=(_=1)--)for(;++_&& );x=2*O*x+l,O=o-I+i);}
C allows for shorter variable names, and Perl still comes out ahead. Crazy.

Replies are listed 'Best First'.
Re: Re^3: (Golf) Mandelbrot Fractal
by pdcawley (Hermit) on May 09, 2002 at 06:45 UTC
    The only catch appears to be that, when I actually run this, it doesn't work. Of course, I could well be going mad.