;;; Scheme Recursive Art Contest Entrychromatic colors ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Fish Scales or Smileys? ;;; ;;; Description: ;;; (define (selectcolor x) (cond ((and (< 0 x) (> 0.25 x)) 1) ((and (< 0.25 x) (> 0.5 x)) 2) ((and (< 0.5 x) (> 0.75 x)) 3) ((and (< 0.75 x) (> 1 x)) 4) )) (define (happycolor x) (cond ((= x 1) "#ECEC84") ((= x 2) "#FFB69B") ((= x 3) "#A299CA") ((= x 4) "#7CCAEE") )) (define (bgcolor x) (cond ((= x 1) "#0b1122") ((= x 2) "#090e1b") ((= x 3) "#121a34") ((= x 4) "#0e152a") )) (pixelsize 5) (define (background x y) (if (> x 199) (hideturtle) (begin (pixel x y (bgcolor (selectcolor (random)))) (background (+ x 1) y)) )) (define (happy x y) (if (or (> x 500) (< y -500)) (hideturtle) (begin (pu) (setpos x y) (pd) (circle 1) (pu)(setpos x (- y 20)) (pd)(circle 1) (pu)(setpos (+ x 10) (- y 10)) (seth 0) (pd)(circle 20 50) (pu)(setpos (+ x 10) (- y 10)) (seth 0) (pd)(circle 20 -50) (pu) (color (happycolor (selectcolor (random)))) (happy (+ x 50) y) ))) (define (happy-repeat x z y) (if (< y -500) (pu) (begin (happy x y) (happy-repeat (+ x (* -1 z)) (* z -1) (- y 20))))) (define (bgrepeat x y) (if (> y 199) (hideturtle) (begin (background x y) (bgrepeat x (+ y 1))))) (define (draw) (speed 0) (bgrepeat 0 0) (happy-repeat -500 25 500) ) (define random (let ((a 69069) (c 1) (m (expt 2 32)) (seed 19380110)) (lambda new-seed (if (pair? new-seed) (set! seed (car new-seed)) (set! seed (modulo (+ (* seed a) c) m))) (/ seed m)))) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)