;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Mandala ;;; ;;; Description: ;;; Recursive rainbows ;;; Mandala in mandala ;;; Art, CS, unite! (define (repeat function count) (cond ((= count 1) (function)) (else (function) (repeat function (- count 1))) ) ) (define (spiral n n_final poly_side turn r_start g_start b_start scale r_grad g_grad b_grad) (cond ((or (> n n_final) (> r_start 1) (> g_start 1) (> b_start 1))) (else (define (edge) (fd n) (rt (- 180 (/ (* 180 (- poly_side 2)) poly_side)))) (define (shape) (repeat edge poly_side)) (define (turn_square) (shape) (rt turn)) (color (rgb r_start g_start b_start)) (repeat turn_square (/ 360 turn)) (spiral (* scale n) n_final poly_side turn (+ r_start r_grad) (+ g_start g_grad) (+ b_start b_grad) scale r_grad g_grad b_grad) ) ) ) (define (draw) ; (ellipse 5 2 0 45) (spiral 25 40 14 20 0 0 0 1.1 0 0.2 0) ; Green (penup) (rt 90) (fd 300) (lt 90) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0.2 0.1 0) ; Orange (penup) (lt 90) (fd 300) (rt 120) (fd 300) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0.2 0.2 0) ; Yellow (penup) (goto 0 0) (rt 120) (fd 300) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0.2 0 0) ; Red (penup) (goto 0 0) (bk 300) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0.1 0 0.2) ; Indigo (penup) (goto 0 0) (rt 60) (fd 300) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0.2 0 0.2) ; violet (penup) (goto 0 0) (lt 120) (bk 300) (pendown) (spiral 25 40 7 40 0 0 0 1.1 0 0 0.2) ; Blue (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)