;; The first three lines of this file were inserted by DrScheme. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-beginner-reader.ss" "lang")((modname ring) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp"))))) ;; The structrure represents a ring; center is a position (posn) ;; of the center, inner-rad and outer-rad are the inner and the ;; oter raduius values, respectively, and color is a symbol ;; that represents the color (define-struct ring (center inner-rad outer-rad color)) (define (draw-ring a-ring) (and (draw-solid-disk (ring-center a-ring) (ring-outer-rad a-ring) (ring-color a-ring)) (draw-solid-disk (ring-center a-ring) (ring-inner-rad a-ring) 'white) ) ) (start 300 300) (define ring1 (make-ring (make-posn 150 150) 50 100 'red)) (draw-ring ring1) (define (clear-ring a-ring) (clear-solid-disk (ring-center a-ring) (ring-outer-rad a-ring) (ring-color a-ring)) ) (sleep-for-a-while 1) (clear-ring ring1) (define ring2 (make-ring (make-posn 150 150) 40 90 'red)) (define (draw-and-clear-ring a-ring) (and (draw-ring a-ring) (sleep-for-a-while 1) (clear-ring a-ring) ) ) (draw-and-clear-ring ring2) (define ring3 (make-ring (make-posn 150 150) 30 80 'red)) (draw-and-clear-ring ring3) (define ring4 (make-ring (make-posn 150 150) 20 70 'red)) (draw-and-clear-ring ring4) (define ring5 (make-ring (make-posn 150 150) 10 60 'red)) (draw-and-clear-ring ring5)