;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: ;;; ;;; Description: ;;; ;;; Please don't take offense / take this super seriously ;;; A short haiku isn't meant to be a sweeping statement ;;; This is just something to think about ;;; Go Bears! (define (cadr lst) (car(cdr lst))) ;Having 50 subboxes will result in a long run time. If you're trying this out, use 10 instead of 50 (define runs_in_stripe 50);This specifies how many boxes each stripe will be composed of ;By changing this number the flag can be scaled to an arbritrary large size, I was thinking about putting an eyeball it blue portion but it would have to go in as a background picture, which wouldn't scale (define scaling_factor 400) (define flag_red (cons .689 (cons .132 (cons .203 nil)))) (define flag_blue (cons .234(cons .233 (cons .430 nil)))) (define flag_white (cons 1 (cons 1 (cons 1 nil)))) (define (get_red lst) (car lst)) (define (get_green lst) (cadr lst)) (define (get_blue lst) (cadr(cdr lst))) ;This makes a simple box (define (make_box ratio1 ratio2 multiplier) (repeat 2 (lambda () (begin (fd (* ratio1 multiplier)) (rt 90) (fd (* ratio2 multiplier)) (rt 90))))) ;This allows for boxes within boxes (define (inner_box_spacing ratio1 ratio2 multiplier decrement) (define shift (* multiplier decrement)) (begin (fd (/ (* ratio1 shift) 2)) (rt 90) (fd (/ (* ratio2 shift) 2)) (lt 90)) ) ;(bgcolor .1 .1 .1) (bgcolor 0 0 0) (define (repeat k fn) (if (> k 0) (begin (fn) (repeat (- k 1) fn)) 'done)) ;This helps make the colors of the flag fade away into the background (define (greyify color_to_modify) (cons (* (get_red color_to_modify) .9) (cons (* (get_green color_to_modify) .9) (cons (* (get_blue color_to_modify) .9) nil)));The .9 specifies how fast the colors fade away ) ;This builds 'runs' number of boxes within each other (define (inner_boxes ratio1 ratio2 scale_by runs color_vals) (if (> runs 0) (begin (fillcolor (get_red color_vals) (get_green color_vals) (get_blue color_vals)) (pencolor (get_red color_vals) (get_green color_vals) (get_blue color_vals)) (begin_fill) (make_box ratio1 ratio2 scale_by) (penup) (inner_box_spacing ratio1 ratio2 scale_by .1) (pendown) (make_box ratio1 ratio2 (* scale_by .9));The .9 in each call to make box determines how much smaller each box within the stripe gets. (end_fill) (begin_fill) (make_box ratio1 ratio2 (* scale_by .9)) (inner_boxes ratio1 ratio2 (* scale_by .95) (- runs 1) (greyify color_vals));The .95 shifts the subsequent boxes, to create a sort of gradient. If it were .9 the center of the stripe would be darker instead of its edge )) ) ;This builds each stripe of the flag ;ratio1 is the width, ratio is the length (define (build_stripes ratio1 ratio2 scale_by stripes_left org_color starting_x starting_y) (if (> stripes_left 0)( begin (penup) (setpos starting_x starting_y) (pendown) (pencolor (get_red org_color) (get_green org_color) (get_blue org_color)) (inner_boxes ratio1 ratio2 (* scale_by .9) runs_in_stripe org_color) (end_fill) (pencolor (get_red flag_red) (get_green flag_red) (get_blue flag_red)) (build_stripes ratio1 ratio2 scale_by (- stripes_left 1) org_color starting_x (+ starting_y (* 2 ratio2 scale_by)))) ) ) ;This draws each stripe of the flag, and then draws the blue portion of the flag. ;The height to width ratio of the flag is 1:1.9 (define (draw) (ht);The turtle is hidden to speed up the drawing (setpos 0 0) (build_stripes 1.9 (/ 1 13) scaling_factor 3 flag_red 0 0);The US flag has 13 stripes, hence the 1/13 (build_stripes 1.9 (/ 1 13) scaling_factor 3 flag_white 0 (* (/ 1 13) scaling_factor)) (build_stripes 1.14 (/ 1 13) scaling_factor 4 flag_red (* .76 scaling_factor .9) (* 6 (/ 1 13) scaling_factor)) (build_stripes 1.14 (/ 1 13) scaling_factor 3 flag_white (* .76 scaling_factor .9) (* 7 (/ 1 13) scaling_factor)) (build_stripes .76 (* 1.09 (/ 7 13)) scaling_factor 1 flag_blue 0 (* (/ 12 13) scaling_factor)); * 1.09 shouldn't be neccesary (exitonclick)) (speed 0) ; 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)