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

In a wild attempt to redeem myself I get 142:

UPDATE:Removed single line version cause it screws up some peoples screen layout.

Or a little better formatted
map{$i=$_/20-1;map{$r=$j=$_/20-2.3;$z=$i;$b=$";($m=$r*$r)+($n=$z*$z)>4 +? $b="+":($z=2*$r*$z+$i,$r=$m-$n+$j)for a..iv;print$b}0..59;print$/}0..3 +9

Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.

Replies are listed 'Best First'.
Re: Re: Re: Re: (Golf) Mandelbrot Fractal
by YuckFoo (Abbot) on May 08, 2002 at 19:11 UTC
    Knock off a couple more. 26 iterations is plenty, so a..iv can be a..z. Also ($m=$r*$r)>4 is a sufficient test, so
    ($m=$r*$r)+($n=$z*$z)>4 #becomes: $n=$z*$z,($m=$r*$r)>4

    YuckFoo

    Update: Thanks belg4mit, changed semi-colon to comma to work in demerphq's code which becomes:

    map{$i=$_/20-1;map{$r=$j=$_/20-2.3;$z=$i;$b=$";$n=$z*$z,($m=$r*$r)>4 ?$b="+":($z=2*$r*$z+$i,$r=$m-$n+$j)for a..z;print$b}0..59;print$/}0..3 +9
      Your change in the test doesn't work with demerphq's code. It does work in my 146 though (for a total of 143).
      map{$i=$_/20-1;map{$r=$j=$_/20-2.3;$z=$i;$b=$";$n=$z*$z;($m=$r*$r)>4? $b="+":($z=2*$r*$z+$i,$r=$m-$n+$j)for a..z;print$b}0..59;print$/}0..39 __END__ ++++++++++++++++++++++++++ +++++++ +++++++++++++++++ ++++++++ ++++++++++++ + +++++++++ ++++++++++ ++++++++++ ++++++++ +++++++++++ ++++++ ++++++++++++ +++ +++++++++++++ ++++++++++++++ + ++++++++++++ ++ ++++++++++ +++ ++++++++++ ++++ ++++++++ + +++++ +++++++++ ++++++ ++++++++ ++++++ ++++++++ +++++++ +++++++ +++++++ +++++++ ++++++++ ++++++ ++++++++ ++++++ ++++++++ ++++++ ++++++++ ++++++ ++++++++ ++++++ ++++++++ +++++++ ++++++++ +++++++ +++++++ ++++++++ +++++++ ++++++++ ++++++ +++++++++ ++++++ ++++++++ + +++++ ++++++++++ ++++ ++++++++++ +++ ++++++++++++ ++ ++++++++++++++ + +++++++++++++ ++++++++++++ +++ +++++++++++ ++++++ ++++++++++ ++++++++ +++++++++ ++++++++++ ++++++++ ++++++++++++ + +++++++ +++++++++++++++++

      --
      perl -pew "s/\b;([mnst])/'$1/g"