Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Re: Re: (Golf) Mandelbrot Fractal

by demerphq (Chancellor)
on May 08, 2002 at 18:54 UTC ( [id://165132]=note: print w/replies, xml ) Need Help??


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"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://165132]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-23 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found