;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: ;;; ;;; Description: ;;; ; draw an isosceles triangle with height HEIGHT and base length BASE (define (isosceles height base) (define hyp (sqrt (+ (expt height 2) (expt (/ base 2) 2)))) (define angle (degrees (asin (/ height hyp)))) (right (+ 90 angle)) (forward hyp) (right (- 180 angle)) (forward base) (right (- 180 angle)) (forward hyp) (left (- 90 angle)) ) (define (bird size fill-color) (define (scale factor) (* size factor)) (pendown) (color fill-color) (begin_fill) ; tail (isosceles (scale 0.5) (scale 0.33)) (right 180) (forward (scale 0.25)) ; body (isosceles size (scale 0.33)) (end_fill) (begin_fill) ; left wing (right 145) (penup) (forward (scale 1.1)) (pendown) (isosceles (scale 0.25) (scale 1.25)) (penup) (backward (scale 1.1)) ; right wing (right 70) (forward (scale 1.1)) (pendown) (isosceles (scale 0.25) (scale 1.25)) (penup) (backward (scale 1.1)) (pendown) (left 35) (forward size) (forward (scale 0.25)) ; head (isosceles (scale 0.25) (scale .33)) ; beak (forward (scale 0.0825)) (isosceles (scale 0.165) (scale 0.0825)) (end_fill) (penup) ) (define (flock num-birds size bird-colors) (cond ((not (= 0 num-birds)) (bird size (car bird-colors)) (right 45) (forward (* 1.8 size)) (flock (- num-birds 1) (* .8 size) (cdr bird-colors)) ) ) ) (define (sun num-rays radius sky-colors) (cond ((not (= 0 num-rays)) (sun-ray radius (car sky-colors)) (sun (- num-rays 1) (quotient radius 1.2) (cdr sky-colors)) ) ) ) (define (sun-ray radius fill-color) (setpos (+ radius 100) 100) (pendown) (color fill-color) (begin_fill) (circle radius) (end_fill) (penup) (setpos 100 100) ) (define sky-colors (list "#14c0ff" "#29c5ff" "#3dcbff" "#52d0ff" "#66d6ff" "#7bdbff" "#90e0ff" "#a4e6ff" "#b9ebff" "#cdf1ff" "#e2f6ff" "#f7fcff")) (define bird-colors (list "#141414" "#282828" "#3c3c3c" "#505050" "#646464" "#787878""#8c8c8c" "#a0a0a0" "#b4b4b4" "#c8c8c8" "#dcdcdc" "#f0f0f0")) (define (draw) (speed 0) (bgcolor "#00bbff") (sun 12 400 sky-colors) (penup) (setpos -150 -180) (setheading 325) (flock 12 100 bird-colors) (hideturtle) (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)