;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: This Should be Blue Because I am Sad I ran Out of Memory ;;; ;;; Description: ;;;it is sad but true ;;;not a lot rhymes with purple ;;;time for sleep is now ;;; Complex Number Abstraction (define (make_num real imaginary) (cons real imaginary) ) (define (real n) (car n) ) (define (imaginary n) (cdr n) ) (define (complex_add a b) (make_num (+ (real a) (real b)) (+ (imaginary a) (imaginary b))) ) (define (complex_square n) (make_num ( - (* (real n) (real n)) (* (imaginary n) (imaginary n))) (* 2 (real n ) (imaginary n))) ) (define (square_abs n) ( + (* (real n) (real n) ) (* (imaginary n) (imaginary n))) ) ;;; End Complex Abstraction (define (check c z count) (cond ((> (square_abs z) 4) (cons count z)) ((> count 256) (cons count True)) (else (check c (complex_add (complex_square z) c) (+ count 1))) ) ) (define (draw) (delay 0) (hideturtle) (define (place x y) (define val (check (make_num (+ (* (/ (- real_max real_min) x_dim) x) real_min) (+ (* (/ (- imag_max imag_min) y_dim) y) imag_min)) (make_num 0 0) 0)) (penup) (goto ( - (* (/ (screen_width) x_dim) x) (/ (screen_width) 2)) ( - (* (/ (screen_height) y_dim) y) (/ (screen_height) 2))) (pendown) (if (equal? (cdr val) True) (color "BLACK") (begin (define col (/ (+ (sin (+ (* 4 3.1415 (- (+ (car val) 1) (/ (log (/ (/ (log (square_abs (cdr val))) 2) (log 2))) (log 2))) (/ 1 256) ) 512)) 1) 2)) (color (rgb (/ col 2) (/ col 2) col ) ) ) ) (forward 1) ) (define real_min -1.25163056569) (define real_max -1.25080794804) (define imag_min -.02758819148788) (define imag_max -.02676557483319) (define x_dim 512) (define y_dim 512) (setup x_dim y_dim) (define (iterate x_pix y_pix) (if (< y_pix y_dim) (begin (place x_pix y_pix) (if (equal? x_pix x_dim) (iterate 0 (+ y_pix 1)) (iterate (+ x_pix 1) y_pix) ) ) ) ) (iterate 0 0) ) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)