CSC 160 Spring 2006 - Homework 7
Assigned March 28, due WEDS April 5
Revisions (to all questions but #2) due MONDAY April 10th
Before starting the assignment:
Download the "tiles"
teachpack.
Install the "world" and "tiles" teachpacks.
The assignment may be done alone or in pairs. (You
cannot pair up with the same person more than once during the
semester.)
You must show all steps of the Design Recipe for each of
these image functions. (Note: When defining variables, you must do it
someone before the actual function. Therefore, you can either do
it right above the function or above that function's Design
Recipe.)
1. Develop a function named blot which takes an image and a
string (color). It returns the image with the center covered by a dot
(small disk) with that color.
2. Develop a function named mirror-vert, which is similar to
the mirror-horiz function written in class, except that the image is
reflected vertically. Your original image should be on top, and the
reflected version directly underneath it.
3. Develop
a function named checkerboard which takes in two colors and
returns a 2x2 checkerboard arrangement of them (i.e. the colors in the
two rows are in the opposite order). For full credit, you must use
the counterchange function we wrote in class.
(Hint: Create solid rectangles with each of the colors.)
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.
More extra credit: Use Scheme's ceiling or floor
function to deal with radii that are positive integers but not multiples
of 4.
| Grading |
Purpose |
Contract |
Examples |
Skeleton |
Definition |
Testing |
Abstraction |
| Question 1 |
/3 |
/3 |
/3 |
/3 |
/15 |
/3 |
| Question 2 |
/3 |
/3 |
/3 |
/3 |
/15 |
/3 |
| Question 3 |
/3 |
/3 |
/3 |
/3 |
/15 |
/3 |
/10 |
Last Modified: 4/1/06