Here are some hints for thinking about the implementation:
Essentially, your interpreter has to generate the frames shown on the project handout to produce your animation. Rather than produce separate drawing windows per frame though, you will produce one drawing window in which each frame shows over time.
Note that shapes disappear from the screen when their move time has elapsed and the animation stops when there are no more shapes left to animate. That's a key idea in how to organize the code that generates the frames.
Start by writing a function that takes an animation in its current form and draws it on screen. Then figure out how to update the animation for the next frame. The rest of the design should flow smoothly from there.
As long as your animations run in time approximate to what the programmer listed, with the shapes moving as specified across that time, you do not need to get the times exact. Shapes can move slightly different amounts per frame if that makes it easier. Don't spend tons of time getting the math exact -- I'm interested in seeing that you can organize an interpreter for this sort of problem, not that you can figure out the math to move a shape in exact intervals across a screen.
random : number -> number
returns a random natural number smaller than the given number.
-
current-seconds : -> number
returns a (large) positive number for the number of seconds that
DrScheme has been running. You may use this with set!
to
record the time when you started running an animation.
Leave yourself enough time to do this assignment! Remember that there are 75 of you and only 5 of us, and next week's office hours could get busy, especially later in the week. This project is certainly doable with what we've covered this term, but it does require you to pull together all the material we've covered so far. For most of you, that will take a bit more time than you're probably expecting.