Language Level: | Beginning Student |
Teachpacks: | image.ss |
image.ss
teachpack, which provides a collection of functional utilities for building images. Homworks are due before class on Monday mornings: email your Scheme files (as saved from DrScheme) to CS199Homework. You must hand in your work before that time to receive credit, as solutions will be discussed in class.Start DrScheme.
Set the language level to Beginning Student
.
Add the image.ss
teachpack.
The image.ss
teachpack provides functions such as rectangle
, circle
, ellipse
, etc. You can put images on top of one another by using overlay
and overlay/xy
. You can find documentation on the available functions by searching DrScheme's help system for "image.ss". We suggest you find the image.ss
documentation and leave it open on your screen while you are working on the hoemwork.
On colors: DrScheme understands HTML's named colors, a huge assortment including darksalmon
, papayawhip
and blanchedalmond
. These (often whimsical) color names can be freely used, as symbols, with image.ss
, as in
(circle 100 'solid 'dodgerblue)
Write the function
;; face: num -> image
face
is the radius of the image produced.
Be careful and attempt to match the proportions of the example closely. Your face need not match the face above exactly, but the main part of the face must be a circle and the eyes must be ellipses.
No matter what radius is given, the image of the face should never be distorted; that is, its proportions must remain true at any size. Note how all three of the following faces are similarly proportioned:
face
to 40, 80, and 120 respectively.
Cheer up!
Write a second function
;; happy-face: num -> image
face
function intact.
A hint: in my creation of the smile, I used the image.ss
function shrink-bl
, which crops in image from the bottom-left
Make sure that happy-face
, like face
, scales correctly.
Save your file from DrScheme, attach it to an email message. Put the names of both partners in the body of the email. Submit your email to CS199Homework