;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname entry11) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp"))))) ;; , Lab 3 (start 800 600) ; These make up the background, the sky, the ground, and the seed in the ground in their respective order. (draw-solid-rect(make-posn 0 0) 800 600 'blue) (draw-solid-rect(make-posn 0 520) 800 200 'brown) (draw-solid-disk(make-posn 385 570) 7 'green) ;;This structure is multiple cirlces, center is the center posn of ;;the circle, radius is the raidus of the circle, and color is ;;a symbol that denotes the color (define-struct cloud (center radius color)) ;; draw-cloud: circle -> boolean ;; Purpose: to draw several cirlces, looking like a cloud (define (draw-cloud c) (draw-solid-disk (cloud-center c) (cloud-radius c) (cloud-color c))) (define cloud1 (make-cloud (make-posn 250 100) 60 'white)) (define cloud2 (make-cloud (make-posn 210 130) 50 'white)) (define cloud3 (make-cloud (make-posn 300 100) 50 'white)) (draw-cloud cloud1) (draw-cloud cloud2) (draw-cloud cloud3) (sleep-for-a-while 1) ; Seed growing (draw-solid-rect(make-posn 384 545) 4 20 'green) (sleep-for-a-while 1) ; Seed getting closer (draw-solid-rect(make-posn 384 520) 4 30 'green) (sleep-for-a-while 1) ; Trunk of the tree (draw-solid-rect(make-posn 382 460) 9 60 'brown) ; Branches of the tree (draw-solid-disk(make-posn 385 430) 30 'green) (sleep-for-a-while 1) ; Clearing of the cloud - adding an actual clear function for the cloud proved useless because it clears it to the white color, and it's already white. (draw-solid-rect(make-posn 0 0) 800 300 'blue) ; Moving the cloud (define cloud4 (make-cloud (make-posn 270 100) 60 'white)) (define cloud5 (make-cloud (make-posn 230 130) 50 'white)) (define cloud6 (make-cloud (make-posn 320 100) 50 'white)) (draw-cloud cloud4) (draw-cloud cloud5) (draw-cloud cloud6) ; Branches of tree growing more (draw-solid-disk(make-posn 385 390) 80 'green) (sleep-for-a-while 1) ; The trunk getting larger (draw-solid-rect(make-posn 382 460) 11 60 'brown) ; The tree expanding more! (draw-solid-disk(make-posn 385 350) 120 'green) ; Clearing of the seed (draw-solid-rect(make-posn 0 520) 800 200 'brown) (sleep-for-a-while 1) ; Tree almost to huge state (draw-solid-disk(make-posn 385 280) 200 'green) (sleep-for-a-while 1) ; Tree to huge state (draw-solid-disk(make-posn 385 280) 500 'green)