Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: (Golf) Mandelbrot Fractal

by belg4mit (Prior)
on May 08, 2002 at 18:06 UTC ( [id://165117]=note: print w/replies, xml ) Need Help??


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

149 baby!
map{$i=$_*.05-1;map{$r=$j=$_*.05-2.3;$z=$i;$b=$";for(a..iv){$m=$r*$r;$ +n=$z*$z; $m+$n>4?$b="+":($z=2*$r*$z+$i,$r=$m-$n+$j)}print$b}0..59;print$/}0..39

148 for a tie

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

Meanwhile, in the chatterbox...
demerphq $i=$_*.05-1; could be written as $i=$_/2-1; couldnt it?
belg4mit no, it's not .5
belg4mit although /20 works ;-)

146! @ Wed May 8 14:42:11 EDT 2002

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

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

Replies are listed 'Best First'.
Re: Re: Re: (Golf) Mandelbrot Fractal
by demerphq (Chancellor) on May 08, 2002 at 18:54 UTC
    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.

      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://165117]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-03-28 22:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found