;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: tessel ;;; ;;; Description: ;;; One piece. Two piece. Three. ;;; Individually simple ;;; Together dazzling (define triangle_color "#062c56") (define pentagon_color "#F03C2E") (define pentagon_color_shadow "#F2F2F2") (define scale 2) (define (addScale val dVal) (+ val (* dval scale)) ) (define (scale_goto x y dx dy) (goto (addScale x dx) (addScale y dy)) ) (define (doTriangle x y) ;draws a triangle at x y position (color triangle_color) (begin_fill) (scale_goto x y 8 8) (scale_goto x y 21 -5) (goto x y) (end_fill) ) (define (doPentagon x y) ;draws a triangle at x y position (color pentagon_color) (begin_fill) (scale_goto x y 13 13) (scale_goto x y 34 8) (scale_goto x y 13 -13) (goto x y) (end_fill) ) (define (doShadow x y) ;draws a triangle at x y position (color pentagon_color_shadow) (begin_fill) (noPenMove x y) (scale_goto x y -21 -21) (scale_goto x y 0 -26) (scale_goto x y 21 -5) (goto x y) (end_fill) ) (define (doUnit x y switch) ;draws a unit at x y position (doTriangle x y) (doPentagon (addScale x 8) (addScale y 8)) (if switch (doShadow x y) nil ) ) (define (noPenMove x y) (penup) (goto x y) (pendown) ) (define (outofbounds? x y) (cond ((> x (/ (screen_width) 2)) #t) ((< x (/ (screen_width) -1.2)) #t) ((> y (/ (screen_height) 1.2)) #t) ((< y (/ (screen_height) -1.2)) #t) (else #f) ) ) ; OUTOF BOUNDS -> x is too high or y is too high (define (doUnitForward x y dx dy switch) (if (outofbounds? x y) nil (begin (noPenMove x y) (doUnit x y switch) (doUnitForward (addScale x dx) (addScale y dy) dx dy (not switch)) ) ) ) (define (doRow x y) (if (outofbounds? x y) nil (begin (noPenMove x y) (doUnitForward x y 34 8 #t) (doUnitForward x y -34 -8 #t) (doRow (addScale x -8) (addScale y -34)) ) ) ) (define (draw) (speed 0) ; (turtle-canvas 10 10) ; (turtle-canvas 3200 1600) ; (turtle-grid 3200 1600) (doRow (/ (screen_width) -2) (/ (screen_height) 2)) (print "done") (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)