aUCBLogo Demos and Tests / julia
to julia
; c=-1+0i
; c=0.360284+0.100376i
c=0.315209+0.03758i
cs hT
t=timefine
juliaset c
(pr timefine-t "seconds)
end
to juliaset c
local [c1 c2 extent half quarter m n x0 y0 x y xs j z]
c1 = real(c) ; -1.0 # default is -1.0 + 0.0i
c2 = imag(c) ; 0.0
extent = 600
half = 600 / 2
quarter = extent / 4
maxiter=100
color=array maxiter
repeat maxiter
[ color.repcount=hsb 240*repcount/maxiter 1 1
]
repeat extent
[ m=repcount
x0=-2+m/quarter
repeat half
[ n=repcount
y0=2-n/quarter
z=x0+y0*1i
j=mandelIterate z c maxiter
setPixel se m-half n-half color.j
setPixel (se half-m half-n) color.j
]
if (mod m 16)==0 [updateGraph]
]
end
to mandelIterate_old z c maxiter
repeat maxiter ; compute orbit
[ z*=z
z+=c
if z > 4 [output repcount]
]
output maxiter
end