16 lines
502 B
INI
16 lines
502 B
INI
(function mandelbrot width height depth
|
|
(.. str
|
|
(for yy (range height)
|
|
xx (range width)
|
|
(let c_re (/ (* (- xx (/ width 2)) 4) width)
|
|
c_im (/ (* (- yy (/ height 2)) 4) width)
|
|
x 0 y 0 i 0)
|
|
(while (and (<= (+ (** x) (** y)) 4)
|
|
(< i depth))
|
|
(let x2 (+ c_re (- (** x) (** y)))
|
|
y (+ c_im (* 2 x y))
|
|
x x2
|
|
i (inc i)))
|
|
(strn ((zero? xx) "\n") (i "ABCDEFGHIJ ")))))
|
|
|
|
(mandelbrot 48 24 10)
|