Melly has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
The following script works on Win32 (produces a crude mandelbrot), but fails on Linux (produces zeroes only).
I've put the output under the readmore, but here's the code... (oh, and I should add that this is the end result of some golf, hence no strict, etc.)
map{ $a=1-$_/10; map{ $d=$a; $e=$b=$_/20-2; map{ ($d,$e)=(2*$d*$e+$a,$e**2-$d**2+$b); $c=$d**2+$e**2>4?_:0 }1..99; print$c }0..59; print$/ }0..20;
Win32 Output:
________________________________________0___________________ ____________________________________________________________ ____________________________________0000____________________ ____________________________________0000____________________ ______________________________0__0000000000_________________ ______________________________00000000000000000_____________ ____________________________0000000000000000000_____________ ___________________________000000000000000000000____________ _________________0000000__0000000000000000000000____________ ________________000000000_0000000000000000000000____________ 0000000000000000000000000000000000000000000000______________ ________________000000000_0000000000000000000000____________ _________________0000000__0000000000000000000000____________ ___________________________000000000000000000000____________ ____________________________0000000000000000000_____________ ______________________________00000000000000000_____________ ______________________________0__0000000000_________________ ____________________________________0000____________________ ____________________________________0000____________________ ____________________________________________________________ ________________________________________0___________________
Linux:
000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000
Tom Melly, pm@tomandlu.co.ukmap{$a=1-$_/10;map{$d=$a;$e=$b=$_/20-2;map{($d,$e)=(2*$d*$e+$a,$e** 2-$d**2+$b);$c=$d**2+$e**2>4?_:0}1..99;print$c}0..59;print$/}0..20;
Back to
Seekers of Perl Wisdom