;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: ;;; ;;; Description: ;;; (define (draw) ; YOUR CODE HERE (define branch-cycle-count 40) ;(define move-distance 30) ;(define branch-count 6) (define branch-cycle-rotation 1) ;(define rotation-per-branch (/ 360 branch-count)) (define tree-count 3) (define ok-text-frequency 5) (define branch-change 2) (define (reset-position) ; move back to the center (penup) (setposition 0 0) (setheading 0) (pendown) ) (define (branch cycle base-color message move-distance) ; cycle is # of times this has run (cond ((= cycle branch-cycle-count) nil) (else (color base-color) (fd move-distance) (rt cycle) ; draws the word 'ok' at a certain frequency (if (and (= (modulo cycle ok-text-frequency) 0) (not (= 0 cycle))) (begin (color "#f4b942") (text message) )) (branch (+ cycle branch-cycle-rotation) base-color message move-distance) ) ) ) (define (tree cycle base-rotation base-color message branch-count start-rotation move-distance) (cond ((= cycle branch-count) nil) (else (reset-position) (rt start-rotation) ; might not be necessary ; draw the current branch and then rotate (rt (* base-rotation cycle)) (branch 0 base-color message move-distance) (tree (+ cycle 1) base-rotation base-color message branch-count start-rotation move-distance) ) ) ) (define (draw-trees num branch-count) (cond ((= num tree-count) nil) (else (define base-color (cond ((= num 0) '"red") ((= num 1) '"white") ((= num 2) '"yellow") ) ) (define message (cond ((= num 0) '42s) ((= num 1) 'py) ((= num 2) 'ok) ) ) (tree 0 (/ 360 branch-count) base-color message branch-count (* 20 num) (- 30 (* num 10))) (draw-trees (+ num 1) (- branch-count branch-change)) ) ) ) (bgcolor '"#10124f") (speed 0) ; instantly draws (hideturtle) (pensize 3) (draw-trees 0 6) (reset-position) ;(define message 'stuck) ;(text message) ; END YOUR CODE HERE (exitonclick) ) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)