CSC 160 Fall 2005 Homework 5
Assigned Nov 1, Due SUNDAY Nov 13, Revisions Due WEDS Nov 16


Download and read over these sample animations.

Submitting this Assignment
--You may complete this assignment alone or in pairs. However you cannot use the same partner as HW4.
--For each function, be sure to follow the design recipe. Write all the function purposes, contracts, examples, skeletons, and function definitions. All three questions should be in the same Definitions Window. Save as hw5[LastName]Def.scm.
--Also test each program. Save the resulting Interactions Window as hw5[LastName]Test.scm.
--If you do the assignment in pairs, include both last names in each file name.


The Assignment
1. Develop the function blot which takes an image and a string (color). It returns the image with the center covered by a dot (small circle) with that color.


2. Develop a function named checkerboard which takes in two colors and returns a 2x2 arrangement of them. (Hint: This should be easier if you re-use function we wrote in class!) (Another Hint: you can represent the two colors using solid rectangles that are both the same size.)


Extra Credit: Develop the function bullseye which draws a target with a blue outer circle, green middle circle and red "bulls eye" (innermost circle). This function should be able to draw any size bullseye. This function takes in a positive multiple of 4 (e.g. 4, 8, 12, ..., 40), the radius of the outer circle. The middle circle should have 1/2 the radius of the outer circle. And the bullseye should have 1/2 the radius of the middle circle.
For more extra credit, use Scheme's ceiling or floor function to deal with radii that are positive integers but not multiples of 4.


3. Develop an animation that displays a rectangle that switches colors between green, yellow, and red every second. (Hint: Refer to the "You write one" example in the animation slides.)



Grading Purpose Contract Examples Skeleton Template Definition Testing
Question 1 /3 /3 /3 /3 /15 /3
Question 2 /3 /3 /3 /3 /15 /3
Extra Credit /2 /2 /2 /2 /10 /2
Question 3 (explain the world) /2
Question 3 (show-world) /1 /1 /2 /1 /8 /2
Question 3 (handle-tick) /1 /1 /2 /1 /2 /8 /2
Question 3 (big-bang) /2
Question 3 (on-redraw-event) /2
Question 3 (on-tick-event) /2


Last Modified: 11/15/05