;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Sunset Generator with Binary Tree ;;; ;;; Description: ;;; (define (draw) (ht) ; Sky (draw_sky 192 sky_colors) ; Sunset (triangle 0 75 -75 75 150 "#ffe700") (double_triangle 0 75 -150 -75 150 "#ffce00") (double_triangle 0 75 -250 -150 150 "#ff8a29") (double_triangle 0 75 -360 -250 150 "#f8ceb8") (double_triangle -360 150 -360 0 75 "#f8aeb8") ; Sun (fd 37.5) (dot 75 "#fdff2c") ; Mountains (double_triangle -240 0 -360 -120 -150 "#ce7d3a") (triangle 0 0 -180 180 -225 "#ce7d3a") ; Grass (rectangle -225 135 -360 720 "#8bb827") ; Palm Trees (palm_tree -225) (palm_tree 165) (exitonclick) ) (define (move x y) (pu) (goto x y) (pd) ) (define (draw_sky start_position colors) (if (null? colors) (rectangle 75 300 -360 720 "#8febff") (begin (rectangle start_position 42 -360 720 (car colors)) (draw_sky (+ start_position 42) (cdr colors)) ) ) ) (define sky_colors '("#cff7ff" "#adf0ff" "#8febff" "#64e4ff" "#35dbff")) (define (rectangle top_position height left_position length colour) (begin_fill) (color colour) (move left_position top_position) (setx (+ left_position length)) (sety (- top_position height)) (setx left_position) (sety top_position) (end_fill) ) (define (triangle tip_x tip_y edge1_x edge2_x base_y colour) (begin_fill) (color colour) (move edge2_x base_y) (setx edge1_x) (goto tip_x tip_y) (goto edge2_x base_y) (end_fill) ) (define (double_triangle tip_x tip_y edge1_x edge2_x base_y colour) (triangle tip_x tip_y edge1_x edge2_x base_y colour) (triangle (abs tip_x) tip_y (abs edge1_x) (abs edge2_x) base_y colour) ) (define (palm_tree left_position) ; Tree Trunk (rectangle 0 292.5 left_position 60 "#644643") (color "#7a6564") (lines left_position -292.5) ; Tree Head (begin_fill) (color "#578335") (tree_head 5) (end_fill) ) (define (lines left_position start) (if (< start 0) (begin (move (+ left_position 60) start) (seth 270) (fd 60) (lines left_position (+ start 11.7)) ) ) ) (define (tree_head n) (if (> n 0) (begin (fd 60) (rt 120) (fd 60) (lt 60) (tree_head (- n 1)) ) ) ) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)