;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Tail Recursion: Acorny Pun ;;; ;;; Description: ;;; (define (draw) (define-macro (repeat exprs) `(lambda (times) (if (> times 0) (begin ,exprs ((repeat ,exprs) (- times 1))) nil) ) ) (bgcolor "#48c6e2") (speed 0) (hideturtle) (define (fb-draw length) (forward length) (penup) (backward length) (pendown) ) (define (move x y h) (penup) (setposition x y) (setheading h) (pendown) ) (define (rect s1 s2) (begin_fill) (forward s1) (right 90) (forward s2) (right 90) (forward s1) (right 90) (forward s2) (right 90) (end_fill) ) (define (acorn size stem-length) (forward stem-length) (right 180) (color "#e0933c") (begin_fill) (left 90) (forward (* size 8.8)) (left 70) (circle (* size 20) 80) (left 60) (circle (* size 20) 80) (left 70) (end_fill) (color "#F8D3A5") (forward (* size 17.6)) (left 70) (circle (* size 20) 80) (left 60) (circle (* size 20) 80) (left 70) (color "brown") (backward (* size 2)) (begin_fill) (right 30) ((repeat (begin (circle (* size 22) 60) (left 120)) ) 2) (left 40) (end_fill) (begin_fill) (forward (* size 11)) (right 180) (circle (* size 3.5) 360) (end_fill) (right 100) (backward (+ (* size 2) stem-length)) ) (define (acorn-top size x y h) (move x y h) (color "#F8D3A5") (begin_fill) (circle (* size 10)) (end_fill) (penup) (left 90) (forward (* size 6)) (right 90) (pendown) (color "brown") (begin_fill) (circle (* size 4)) (end_fill) ) (define (tail detail) (if (< detail 0.5) (acorn 0.5 10) (begin (left 80) (tail (* detail 0.55)) (right 160) (tail (* detail 0.5)) (left 74) (forward (* 20 detail)) (tail (- detail 0.5)) (penup) (backward (* 20 detail)) (pendown) (left 6) ) ) ) (define (paw x y h) (move x y h) (left 35) ((repeat (begin (right 15) (acorn 0.7 50)) ) 4) (left 22.5) (acorn 2 0) ) (define (cloud size x y) (move x y 0) (color "white") (if (< size 1) (begin (begin_fill) (circle (* size 27)) (end_fill) ) (begin (cloud (/ size 2) x y) (cloud (/ size 3) (- x 23) (+ y 11)) (cloud (/ size 2) (+ x 2) (+ y 18)) (cloud (/ size 3) (+ x 25) (+ y 5)) ) ) ) (define (grass size x y) (move x y 0) (color "#065409") (if (< y 0) (if (< size 1) (begin (begin_fill) (circle (* 0.5 y) 20) (right 175) (circle (* -0.5 y) 20) (end_fill) ) (begin (grass (/ size 2) (- x (* size 30)) (+ y (* size 12))) (grass (/ size 2) (+ x (* size 10)) (+ y (* size 12))) (grass (/ size 2) (- x (* size 10)) (- y (* size 12))) (grass (/ size 2) (+ x (* size 30)) (- y (* size 12))) ) ) ) ) ;background (color "green") (move (* -0.5 (screen_width)) 0 90) (rect (screen_width) (* 0.5 (screen_height))) (grass 16 0 -200) (cloud 9 30 80) (cloud 5 200 200) (cloud 13 -250 140) ;tail (move 60 -60 10) (tail 4) (move 70 -110 185) (tail 2) ;back leg (paw -70 -180 -140) (move -65 -81 180) (acorn 5 0) ;body (move -50 -20 160) (acorn 9 0) (move -70 92 -147) (acorn 4.2 0) (move 0 80 -130) (acorn 7 0) ;front leg (paw 14 -210 -140) (move 19 -111 180) (acorn 5 0) ;nut (move -140 -10 160) (acorn 4 0) ;arms (move -175 -32 70) (acorn 0.7 0) (move -170 -45 70) (acorn 0.7 0) (move -164 -58 60) (acorn 0.7 0) (move -156 -71 50) (acorn 0.7 0) (paw -50 0 -120) (move 0 62 -147) (acorn 4.2 0) ;head (move -120 210 -30) (tail 1) (move -70 220 20) (tail 1) (acorn-top 2 -15 160 0) (move -100 180 140) (acorn 5 0) (acorn-top 2 -70 150 0) ;mouth (move -33 125 180) (acorn 1.2 0) (move -27 95 30) (acorn 0.7 0) (move -39 95 -30) (acorn 0.7 0) (move -51 95 30) (acorn 0.7 0) (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)