;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: <"I am Iron Man."> ;;; ;;; Description: ;;; (define (draw) ; hideturtle (ht) ; Set background color to black (bgcolor "black") ; Helper function ; Reading rgb color lists (define (r c) (car c)) (define (g c) (car (cdr c))) (define (b c) (car (cdr (cdr c)))) ; Color builder from rgb color lists ; bc = build color (define (bc c) (color (rgb (r c) (g c) (b c)))) ; Hepler function ; Draw circle who is centered at the starting point ; cc = centered-circle; s = radius; c = color (define (cc s c) (bc c) (fd s) (lt 90) (begin_fill) (circle s) (end_fill) (lt 90) (fd s) (lt 180) ) ; Recursively draw back circle ; rbc = recursive back circle ; mc and mr stands for mutation function for radius and color (define (rbc s c ms mc n) (if (> n 0) (begin (cc s c) (define s (ms s)) (define c (mc c)) (rbc s c ms mc (- n 1)) ) ) ) ; The back circle is divided into serveral parts to enhance the sense of dimension ; Initial radius (s) (define s (/ (screen_width) 4)) ; Initial color (c) ; (define c '(0.0 0.66 0.83)) ; loop 1 (define (s1 s) (* 0.98 s)) (define (c1 c) (list 0.0 (* (g c) 0.98) (* (b c) 0.98))) ; final c (0.0 0.37 0.46) (rbc s '(0.0 0.66 0.83) s1 c1 30) (define c '(0.18 0.88 1.0)) ; loop 2 (define (s2 s) (* 0.986 s)) (define (c2 c) (list (* (r c) 1.1) (* 1.008 (g c)) 1.0)) ; final c (0.75 1.0 1.0) (rbc (* s 0.5) c s2 c2 15) ; loop 3 ; (define c '(0.75 1 1)) (define (c3 c) (list (* (r c) 0.91) (* 0.992 (g c)) 1.0)) ; final c (0.18 0.88 1.0) (rbc (* s 0.4) '(0.75 1 1) s2 c3 15) (cc (* s 0.32) '(0.13 0.47 0.56)) ; loop 4 ; (define c '(0.18 0.88 1.0)) (define (s3 s) (* 0.96 s)) (rbc (* s 0.288) c s3 c2 15) ; Recursively draw sallite circles (define (s4 s) (* 0.9 s)) ; dl = draw lighter centered circle (define (dl s c) (rbc s c s4 c2 15)) ; tr = trajectory of centers of satillite circles ; d = degree (define (tr d s) (if (< d 360) (begin (pendown) (dl (* s 0.07) c) (penup) (circle s 30) (tr (+ d 30) s) ) ) ) (define s (* 0.6 s)) (penup) (fd s) (lt 90) (tr 0 s) (lt 90) (fd s) ; Recursively draw satellite sectors (penup) (seth 336) ; Helper function ; ds = draw sectors (define (ds r-out r-in c deg) (bc c) (penup) (begin_fill) (fd r-in) (pendown) (fd (- r-out r-in)) (lt 90) (circle r-out deg) (lt 90) (fd (- r-out r-in)) (lt 90) (circle (- r-in) deg) (end_fill) (penup) (rt 90) (fd r-in) (lt 180) ) ; rsd = recursively draw sectors (define (rds r-out r-in c n mc deg) (if (= n 0) (ds r-out r-in c deg) (begin (ds r-out r-in c deg) (define r-out (* 0.993 r-out)) (define r-in (* 1.007 r-in)) (define c (mc c)) (define deg (- deg 1)) (lt 0.5) (rds r-out r-in c (- n 1) mc deg) ) ) ) (define (rrds deg) (if (< deg 396) (begin (rds (* 1.8 s) (* 1.25 s) c 15 c2 24) (seth (- 360 deg)) (rrds (+ 36 deg)) ) ) ) (rrds 60) ) (speed 0) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)