| 1 |
(define WINDOW-WIDTH 150) |
| 2 |
(define WINDOW-HEIGHT 180) |
| 3 |
|
| 4 |
; A world is a number. |
| 5 |
; Its display is a blue disk of that size. |
| 6 |
; show-world : world -> image |
| 7 |
(define (show-world diameter) |
| 8 |
(circle diameter "solid" "blue")) |
| 9 |
"Examples of show-world:" |
| 10 |
(show-world 1) "should be a blue dot" |
| 11 |
(show-world 20) "should be" (circle 20 "solid" "blue") |
| 12 |
|
| 13 |
; The next world is one larger. |
| 14 |
; next-world : world -> world |
| 15 |
(define (next-world diameter) |
| 16 |
(+ 1 diameter)) |
| 17 |
"Examples of next-world:" |
| 18 |
(next-world 7) "should be" 8 |
| 19 |
|
| 20 |
"Now let's start the animation!" |
| 21 |
|
| 22 |
(big-bang WINDOW-WIDTH WINDOW-HEIGHT 1 1) |
| 23 |
(on-update-event show-world) |
| 24 |
(on-tick-event next-world) |
| 25 |
|
| 26 |
; From https://home.adelphi.edu/sbloch/class/archive/160/spring2005/examples/ |
| 27 |
|