;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: ;;; ;;; Description: ;;; ; chance (define (chance a b) (= 1 (randint a b))) ; draw a line with length l then turn right r degrees (define (l_t_r l r) (fd l) (rt r)) ; draw a rectangle with width w and height h (define (rectangle w h) (define half_width (/ w 2)) (begin_fill) (lt 90) (bk half_width) (l_t_r w 90) (l_t_r h 90) (l_t_r w 90) (l_t_r h 90) (l_t_r half_width 90) (end_fill) ) ; draw a leaf of approximate size s (define (leaf s) (define half_size (/ s 2)) (begin_fill) (color "#AFA44D") (lt 90) (bk half_size) (l_t_r s 90) (l_t_r s 30) (l_t_r s 120) (l_t_r s 30) (l_t_r s 90) (l_t_r half_size 90) (end_fill) ) ; draw a three-leafed tree with starting tree size t, ; parent branch/child branch ratio of r, ; an angle of a1 in between left and middle branches, ; an angle of a2 in between middle and right branches, ; and a leaf size of l (define (three_leafed_tree_special t r a1 a2 l) (define angle (/ (+ a1 a2) 2)) (cond ((<= t l) (if (chance 1 3) (begin (leaf (/ l 2)) (color "#765F5F")) (begin (fd t) (bk t)))) (else (color "#765F5F") (cond ((and (chance 1 11) (<= t 55)) (three_leafed_tree_special (* t 0.72) r a1 a2 l)) ((and (chance 1 8) (<= t 88)) (three_leafed_tree_special (+ t 6) r a1 a2 l)) ((chance 1 4) (three_leafed_tree_special t r a2 a1 l)) ((chance 1 10) (three_leafed_tree_special t r (- a1 6) (+ a2 6) l)) ((chance 1 8) (three_leafed_tree_special t r (+ a1 7) (- a2 7) l)) (else (rectangle (* 0.1 t) t) (fd t) (lt angle) (three_leafed_tree_special (* t r) r a1 a2 l) (rt a1) (three_leafed_tree_special (* t r) r a1 a2 l) (rt a2) (three_leafed_tree_special (* t r) r a1 a2 l) (lt angle) (bk t) ) ) ) ) ) (define (draw) (bgcolor "#304A77") (speed 0) (tp_goto 0 -240) (three_leafed_tree_special 200 0.65 68 38 23) (lt 90) (begin_fill) (color "#4A7857") (circle 1000) (end_fill) (ht) (exitonclick) ) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)