;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: "Sierpinski Gasket" -- EE16A HW10 Q3 ;;; ;;; Description: ;;; ;;; ;;; (define (avg a b) (/ (+ a b) 2) ) (define (triangle x1 y1 x2 y2 x3 y3) (penup) (goto x1 y1) (pendown) (goto x2 y2) (goto x3 y3) (goto x1 y1) ) (define (gasket x1 y1 x2 y2 x3 y3 depth) (cond ((= depth 0)) (else (triangle x1 y1 x2 y2 x3 y3) (gasket (avg x1 x2) y1 x2 y2 (avg x2 x3) (avg y2 y3) (- depth 1)) (gasket x1 y1 (avg x1 x2) y2 (avg x1 x3) (avg y1 y3) (- depth 1)) (gasket (avg x1 x3) (avg y1 y3) (avg x2 x3) (avg y2 y3) x3 y3 (- depth 1)) ) ) ) (define (draw) (speed 0) (hideturtle) (gasket -500 -450 500 -450 0 (- (* 500 (sqrt 3)) 450) 10) (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)