Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °
| |
|
|
You are not logged in.
Post a replyTopic review (newest first)
Would you give a link to download your compiler?
I am going with (i) first.
That's a great fractal. Well done!
Bob, you are brilliant!
Sorry. Was just about to re-edit that load of rubbish.
I see no i in that line.
Hi Bob
Ok. A common mistake which you can easily fix:
Hi Bob Code:(defun mandelbrot (size filename)
(let ((img (make-8-bit-gray-image size size)))
(declare (type 8-bit-gray-image img))
(loop for i from 1 to (1- size) do
(loop for j from 1 to (1- size) do ;these two loops go through all pixels of the image
(labels ((mb-set (x y nit) ;nit is the number of the iteration
(if (or (> (+ (* x x) (* y y)) 2) (> nit 1000)) ;this bit of code checks if the modulo of z is >2
(setf (pixel img i j) (round(/ 255.0 (1+ nit)))) ;if it is, this bit sets the current pixel to the appropriate shade of grey
(mb-set (+ (- (* x x) (* y y)) (/ (- j (round (/ size 2.0))) 50.0)) (+ (* 2 x y) (/ (- j (round (/ size 2.0))) 50.0)) (1+ nit)) ;if not, this bit sends new information into the next iteration
)
))
(mb-set 0.0 0.0 0)
)
)
)
(write-jpeg-file filename img)
)
)but it produces the picture below...
So what does it produce?
Hi Bob
Hi Bob
hi Stefy
Hi Bob
I use SBCL for CLisp.
What version of lisp? What did you try? (Just one at this stage) |