;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Bell Curves ;;; ;;; Description: ;;; (define (draw) ; YOUR CODE HERE (define (bellcurve) (define (drawaxis) (begin (goto -1000 0) (pendown) (goto 1000 0) (penup) ) ) (define (drawcurve z) ; Draw from -4 to +4 SD (define (normpdf z) (define (pdf z mean sd) (* (/ 1 (* (* sd sd) 6.283185307179)) (expt 2.718281828459 (- 0 (/ (expt (- z mean) 2) (* 2 (* sd sd)))))) ) (pdf z 0 1) ) (if (< z 4) (begin (goto (* z 250) (* 4000 (normpdf z))) (drawcurve (+ z 0.01))) ) ) (begin (drawaxis) (penup) (setposition -1000 0) (pendown) (drawcurve -4) ) ) (define (drawstudents x y) (define (student x y vert) (define (face cx cy radius) (define (face-helper cx cy radius x) (if (<= x radius) (begin (goto (+ cx x) (- cy (sqrt (- (expt radius 2) (expt x 2))))) (face-helper cx cy radius (+ x 1)) ) ) ) (face-helper cx cy radius (- 0 radius)) ) (if (and (< x 900 ) (> y -800)) (begin ; Move painter to starting position (penup) (setposition (+ 25 x) (- y 10)) ; Draw the peasant's head (pendown) (goto (+ x 5) (- y 30)) (goto (+ x 45) (- y 30)) (goto (+ 25 x) (- y 10)) (penup) (setposition (+ x 25) (- y 30)) (pendown) (face (+ x 25) (- y 30) 15) ; Move painter to starting position for body (penup) (setposition (+ x 25) (- y 45)) ; Draw the cross that is the body (pendown) (goto (+ x 25) (- y 75)) (penup) (goto (+ x 5) (- y 60)) (pendown) (goto (+ x 45) (- y 60)) ; Move to position for legs (penup) (goto (+ x 25) (- y 75)) ; Draw them legs (pendown) (goto (+ x 10) (- y 90)) (goto (+ x 25) (- y 75)) (goto (+ x 40) (- y 90)) (if (= vert 1) (student x (- y 100) 1) (begin (student x (- y 100) 1) (student (+ x 50) y 0)) ) ) ) ) (begin (student x y 0) ) ) (begin (bellcurve) (drawstudents -900 0) (goto 1100 -11000) ) ; END MY CODE (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)