| PSICS Fall 2004 Quiz #3 |
|   PSICS Home   |   Description | Grading | Code you need | Submitting |
Submit your solutions to this quiz by dropping in your webct drop box in the box labeled "Quiz3". Let Dave know if you have problems submitting!
| Animation of Kyle |
This quiz involves the development of scheme code to provide a simple animation of a "kyle". You are given a function that will draw a "kyle" at a given position, size and conrol over where kyle is looking. Below is a description of the drawing function and some examples:
;;draw-kyle needs a posn, number and symbol ;; posn is the center of kyle's head. ;; number is the radius of kyle's head. ;; symbol determines where kyle is looking: ;; 'left - he is looking to our left. ;; 'right - he is looking to our right. ;; 'center - he is looking at us.
Here are some examples of what kyle will look like:
(draw-kyle (make-posn 100 100) 50 'left) |
![]() |
(draw-kyle (make-posn 100 100) 50 'center) |
![]() |
(draw-kyle (make-posn 100 100) 50 'right) |
![]() |
There is also a clear-kyle functon.
Your animation should move kyle horizontally across the canvas and change his eyes at the same time (so that he is constantly changing where he is looking). Your animation must include at least 4 different steps.
| Grading |
There are a number of ways to accomplish the animation, your grade will depend on how you implement the animation:
If you simply write a program that calls draw-kyle
and sleep-for-a-while a bunch of times you will receive
a maximum grade of 75
(draw-kyle ... (sleep-for-a-while .. (draw-kyle ... (sleep-for-a-while ..
If you write functions similar to those we used in exercise 6.2.6 to animate kyle, you can receive up to 100. In this case the animation would be accomplished with code that looks something like this:
(draw-a-kyle
(move-kyle-eyes
(move-kyle
(move-kyle-eyes
(move-kyle
(move-kyle-eyes
(move-kyle
(move-kyle-eyes
(move-kyle some-kyle ... )
You can get extra credit (up to 10 points) if you write a function that can animate kyle. The function call should include some parameter that controls how long the animation lasts (like the number of steps, or how far kyle should move, etc.). In this case the actual animation should require just something like this:
(animate-kyle 100 ...
| Kyle Code |
The code you should start with is available here:
quiz3.scm and also as html:
quiz3.scm.html. This code includes the
definition of lots of functions - the only one you need to
use directly is draw-kyle and clear-kyle.
| Submitting your code |
Submit your code as a single program (file) to the WebCT Drop Box labeled "Quiz 3". We should be able to simply run the program and see kyle move (so include the call to the code that actually moves him). Feel free to submit code that has the easy version complete (to make sure you get 75) and partial work of either harder version.