in reply to Re: Re: (Golf) Mandelbrot Fractal
in thread (Golf) Mandelbrot Fractal
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..19Further 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..19Here is the original C code, just for comparison, at 182 characters:
C allows for shorter variable names, and Perl still comes out ahead. Crazy.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);}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re^3: (Golf) Mandelbrot Fractal
by pdcawley (Hermit) on May 09, 2002 at 06:45 UTC | |
by tadman (Prior) on May 09, 2002 at 08:03 UTC |