;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Rubik's Recursion ;;; ;;; Description: ;;; Rubik's Recursion ;;; DeNero and Oski Bear ;;; CS pals always ; This procedure creates the diamond for the top part. (define (large) (begin (begin_fill) (pensize 3) (rt 67.5) (fd 66.6) (lt 135) (fd 66.6) (lt 45) (fd 66.6) (lt 135) (fd 66.6) (lt 112.5) (fill_color "#FFD700") (end_fill))) ; Tree recursive procedures for the top part. (define left (mu (left_pos_x left_pos_y count_left) (penup) (setpos left_pos_x left_pos_y) (pendown) (large) (if (<= count_left 0) (setpos pos_x pos_y) (left (- left_pos_x 61.53037687) (+ left_pos_y 25.4867166) (- count_left 1))))) (define right (mu (right_pos_x right_pos_y count_right) (penup) (setpos right_pos_x right_pos_y) (pendown) (large) (if (<= count_right 0) (setpos pos_x pos_y) (right (+ right_pos_x 61.53037687) (+ right_pos_y 25.4867166) (- count_right 1))))) (define (top pos_x pos_y count) (penup) (setpos pos_x pos_y) (pendown) (large) (if (<= count 0) (begin (penup) (setpos 0 0)) (begin (left (- pos_x 61.53037687) (+ pos_y 25.48671665) (- count 2)) (right (+ pos_x 61.53037687) (+ pos_y 25.4867166) (- count 2)) (top pos_x (+ pos_y 51) (- count 2))))) ; This procedure creates the diamond for the right side. (define (skinny num) (begin (pensize 3) (rt 67.5) (fd 66.6) (lt 67.5) (fd 66.6) (lt 112.5) (fd 66.6) (lt 67.5) (fd 66.6) (rt 180) (penup) (fd 46.0433583) (rt 90) (fd 30.76518843) (lt 90) (register_shape num) (shape num) (stamp) (shape 'classic) (lt 90) (fd 30.76518843) (lt 90) (fd 46.0433583) (rt 180))) ; Tree recursive procedures for the right side. (define s1-left (mu (left_pos_x left_pos_y count_left n-left) (penup) (setpos left_pos_x left_pos_y) (pendown) (skinny n-left) (if (<= count_left 0) (setpos pos_x pos_y) (s1-left 0 (+ left_pos_y 66.6) (- count_left 1) (+ n-left 5))))) (define s1-right (mu (right_pos_x right_pos_y count_right n-right) (penup) (setpos right_pos_x right_pos_y) (pendown) (skinny n-right) (if (<= count_right 0) (setpos pos_x pos_y) (s1-right (+ right_pos_x 61.53037687) (+ right_pos_y 25.4867166) (- count_right 1) (+ n-right 5))))) (define (face1 pos_x pos_y count n) (penup) (setpos pos_x pos_y) (pendown) (skinny n) (if (<= count 0) (begin (penup) (setpos 0 0)) (begin (s1-left pos_x (+ pos_y 66.6) (- count 2) (+ n 3)) (s1-right (+ pos_x 61.53037687) (+ pos_y 25.4867166) (- count 2) (+ n 7)) (face1 (+ pos_x 61.53037687) (+ pos_y 92.0867166) (- count 2) (+ n 2))))) ; This procedure creates the diamond on the left side. (define (skinny2 num) (begin (pensize 3) (lt 67.5) (fd 66.6) (rt 67.5) (fd 66.6) (rt 112.5) (fd 66.6) (rt 67.5) (fd 66.6) (lt 180) (penup) (fd 46.0433583) (lt 90) (fd 30.76518843) (rt 90) (register_shape num) (shape num) (stamp) (shape 'classic) (rt 90) (fd 30.76518843) (rt 90) (fd 46.0433583) (rt 180))) ; Note: names right and left are switched here because of the position of the side. ; Tree recursive procedures for the left side. (define s2-right (mu (right_pos_x right_pos_y count_right n2-right) (penup) (setpos right_pos_x right_pos_y) (pendown) (skinny2 n2-right) (if (<= count_right 0) (setpos pos_x pos_y) (s2-right 0 (+ right_pos_y 66.6) (- count_right 1) (+ n2-right 5))))) (define s2-left (mu (left_pos_x left_pos_y count_left n2-left) (penup) (setpos left_pos_x left_pos_y) (pendown) (skinny2 n2-left) (if (<= count_left 0) (setpos pos_x pos_y) (s2-left (- left_pos_x 61.53037687) (+ left_pos_y 25.4867166) (- count_left 1) (+ n2-left 5))))) (define (face2 pos_x pos_y count n2) (penup) (setpos pos_x pos_y) (pendown) (skinny2 n2) (if (<= count 0) (begin (penup) (setpos 0 0)) (begin (s2-right pos_x (+ pos_y 66.6) (- count 2) (+ n2 3)) (s2-left (- pos_x 61.53037687) (+ pos_y 25.4867166) (- count 2) (+ n2 7)) (face2 (- pos_x 61.53037687) (+ pos_y 92.0867166) (- count 2) (+ n2 2))))) (define (draw) (begin (speed 6) (top 0 0 3) (face1 0 -200 3 11) (face2 0 -200 3 31) (ht) (exitonclick))) ; 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)