;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Colorful Microsoft ;;; ;;; Description: ;;; Colorful & recursive ;;; This is a real Microsoft (define (draw) (bgcolor 'black) (speed 100) (square1 60 0 255 0)) (define (square1 x y c v) (cond [(eq? x y) (pu) (goto 7 0) (pd) (seth 90) (square2 60 0 0)] [else ( (color2 c 0 v) (left 90) (fd x) (right 90) (fd 1) (right 90) (fd x) (left 90) (fd 1) (square1 x (+ y 2) (- c 5) (+ v 5)))])) (define (square2 x y c) (cond [(eq? x y) (pu) (goto 0 (- 7)) (pd) (seth (- 90)) (square3 60 0 255)] [else ((color2 0 255 c) (pd) (fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (square2 x (+ y 2) (+ c 8)))])) (define (square3 x y c) (cond [(eq? x y) (pu) (goto 7 (- 7)) (pd) (seth 90) (square4 60 0 255)] [else ((color2 0 c 255) (fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (square3 x (+ y 2) (- c 8)))])) (define (square4 x y c) (cond [(eq? x y) (pu) (goto 90 (- 37)) (seth 0) (pd) (vertical 80 10 0)] [else ((color2 255 c 0) (fd x) (right 90) (fd 1) (right 90) (fd x) (left 90) (fd 1) (left 90) (square4 x (+ y 2) (- c 8)))])) (define (vertical x y z) (cond [(eq? y z) (pu) (goto 100 42) (pd) (seth 160) (incline 78 10 0)] [else ((color '"#FFFFFF") (fd x) (right 90) (fd 1) (right 90) (fd x) (left 90) (fd 1) (left 90) (vertical x y (+ z 2))]))) (define (incline x y z) (cond [(eq? y z) (pu) (goto 126.6775712 (- 31.29602442)) (pd) (seth 20) (incline2 76 10 0)] [else ((color '"#FFFFFF") (fd x) (right 90) (fd 0.5) (right 90) (fd x) (left 90) (fd 0.5) (left 90) (incline x y (+ z 1))]))) (define (incline2 x y z) (cond [(< y z) (pu) (goto 153.3551424 42) (pd) (seth 180) (vertical2 78 10 0)] [else ((color '"#FFFFFF") (fd x) (right 90) (fd 0.1) (right 90) (fd x) (left 90) (fd 0.1) (left 90) (incline2 x y (+ z 0.2)))])) (define (vertical2 x y z) (cond [(eq? y z) (pu) (goto 180 23) (pd) (seth 180) (vertical3 60 10 0)] [else ((color '"#FFFFFF") (fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (vertical2 x y (+ z 2)))])) (define (vertical3 x y z) (cond [(eq? y z) (draw_circle 30 23 19)] [else ((fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (vertical3 x y (+ z 2)))])) (define (draw_circle x y z) (cond [(< x y) (pu) (goto 260 23) (pd) (seth 180) (vertical4 60 10 0)] [else ( (pu) (goto 247 z) (seth (- 60)) (pd) (circle x 240) (draw_circle (- x 0.2) y (- z 0.18)))])) (define (vertical4 x y z) (cond [(eq? y z) (draw_circle2 20 16 20)] [else ( (color '"#FFFFFF") (fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (vertical4 x y (+ z 2)))])) (define (draw_circle2 x y z) (cond [(< x y) (pu) (goto 185 45) (pd) (seth (- 90)) (draw_circle3 5 1)] [else ( (pu) (goto 290 z) (seth (- 75)) (pd) (circle x 120) (draw_circle2 (- x 0.2) y (- z 0.23)) )])) (define (draw_circle3 x y) (cond [(< x y) (pu) (goto 119 (- 36)) (pd) (seth 90) (optimize 17 1)] [else ((circle x) (draw_circle3 (- x 0.1) y))])) (define (optimize x y) (cond [(< x y) (draw_circle4 30 23 22)] [else ((fd x) (left 90) (fd 0.5) (left 90) (fd x) (right 90) (fd 0.5) (right 90) (optimize (- x 1) y))])) (define (draw_circle4 x y z) (cond [(< x y) (draw_circle5 17 13 19)] [else ((pu) (goto 320 z) (pd) (seth (- 90)) (circle x) (draw_circle4 (- x 0.2) y (- z 0.2)))])) (define (draw_circle5 x y z) (cond [(< x y) (draw_circle6 (- 18) (- 12) (- 4.3))] [else ( (pu) (goto 390 z) (seth (- 45)) (pd) (circle x 215) (draw_circle5 (- x 0.2) y (- z 0.18)))])) (define (draw_circle6 x y z) (cond [(> x y) (draw_circle7 30 23 22)] [else ( (pu) (goto 374 z) (seth 95) (pd) (circle x 230) (draw_circle6 (+ x 0.2) y (- z 0.2)))])) (define (draw_circle7 x y z) (cond [(< x y) (draw_circle8 13 7 504)] [else ((pu) (goto 430 z) (pd) (seth (- 90)) (circle x) (draw_circle7 (- x 0.2) y (- z 0.2)))])) (define (draw_circle8 x y z) (cond [(< x y) (pu) (goto 484.5 25) (pd) (seth 180) (vertical5 60 6 0)] [else ((pu) (goto z 25) (pd) (seth (- 0)) (circle x 180) (draw_circle8 (- x 0.2) y (- z 0.2)))])) (define (vertical5 x y z) (cond [(< y z) (pu) (goto 472.3 10) (pd) (seth 90) (horizontal 20 8 0)] [else ( (fd x) (right 90) (fd 0.5) (right 90) (fd x) (left 90) (fd 0.5) (left 90) (vertical5 x y (+ z 1)))])) (define (horizontal x y z) (cond [(eq? y z) (pu) (goto 512 21) (pd) (seth 180) (vertical6 45 7 0)] [else ( (fd x) (right 90) (fd 1) (right 90) (fd x) (left 90) (fd 1) (left 90) (horizontal x y (+ z 2)) )])) (define (vertical6 x y z) (cond [(< y z) (draw_circle9 13 6 512)] [else ((fd x) (left 90) (fd 1) (left 90) (fd x) (right 90) (fd 1) (right 90) (vertical6 x y (+ z 2)))])) (define (draw_circle9 x y z) (cond [(< x y) (pu) (goto 507 6) (pd) (seth 90) (horizontal2 20 8 0)] [else ( (pu) (goto z (- 23)) (pd) (seth 180) (circle x 160) (draw_circle9 (- x 0.2) y (+ z 0.18)))])) (define (horizontal2 x y z) (cond [(eq? y z) (hideturtle) (exitonclick)] [else ( (fd x) (right 90) (fd 1) (right 90) (fd x) (left 90) (fd 1) (left 90) (horizontal2 x y (+ z 2))]))) ; Please leave this last line alone. You may add additional procedures above ; this line. All Scheme tokens in this file (including the one below) count ; toward the token limit. (draw)