(define WINDOW-WIDTH 100) (define WINDOW-HEIGHT 100) (define DIAMETER 10) ; A world is a string. ; Its display is a ball of that color. ; show-world : world -> image (define (show-world color) (circle DIAMETER "solid" color)) "Examples of show-world:" (show-world "green") "should be" (circle DIAMETER "solid" "green") (show-world "red") "should be" (circle DIAMETER "solid" "red") ; The next world is red if this one's green, and vice versa. ; next-world : world -> world (define (next-world color) (cond [(string=? color "red") "green"] [(string=? color "green") "red"])) "Examples of next-world:" (next-world "green") "should be" "red" (next-world "red") "should be" "green" (big-bang WINDOW-WIDTH WINDOW-HEIGHT 1 "red") (on-update-event show-world) (on-tick-event next-world)