This module is a two week unit and constitutes the first of two programming projects. It counts for 8% of the grade (one module and one half of the project credit). Only exercise 1 is due in lab on Monday, April 2. The rest is due on April 9. There will be no Module G topping exercise in lab on April 2. Thus April 2 is a good opportunity to make up topping off exercises for previous modules, if not yet completed. This is also a good lab to get design and debugging help on the painter graphics.
Goals:
Reading: SICP (Structure and Interpretation of Computer Programs), Section 2.2.4
Code on composers:
~saunders/280/graphics/painters.scm.
The command: drscheme ~saunders/280/graphics/painters.scm
will start scheme with the painter code loaded. Otherwise you can open
it from the file menu. The summary lists most
of the procedures defined in the painter system.
Homework exercise:
Hand in printouts of your scheme code and of your graphics windows. Be sure each image is clearly labeled.
UUUUUU UUUUUU UUCUUU UUUUUU
(stack p:painter n:positive-int) -> q:painter
We will use the notation "x:t" to indicate that the argument x is supposed to be of type t. The output of stack is a painter q, where (q f:frame) will draw a stack of p's in frame f. Painter q will paint n copies of p along the bottom 1/n of f, n-1 copies centered on the next level, and so on, until the top of the n levels has one copy of p centered. Something like this:
p
p p
p p p
p p p p
p p p p p
Illustrate on
123 456 789,The output UPO takes a painter p and paints (top-left p) spread over positions 1&2, paints (top-right p) in 3&6, paints (bottom-right p) in 8&9, paints (bottom-left p) in 4&7, and paints center in 5.
Use your imagination and cook up something you'll enjoy.
Here is a way to print a graphics window in unix (for submitting the result):
Module G Flourishes (optional problems):