|
Computer Science 110 The Art & Science of Computer Graphics Mount Holyoke College Spring 2010
|
|
Lecture 12: More Programming
Date: Monday, March 22, 2010
Agenda
- Announcements
- Surprise lab models
- Programming basics
- conditional execution: if
- building a scene with replicated objects
- A function with multiple uses: adding both salt and pepper
- Another option: adding items from a list
- Adding lots of items in a pattern: a multiAdd function
Lecture Assignment 12
Due at the start of class, Wednesday, March 24.
Please submit answers to these questions
either as a hard copy (typeset or handwritten are OK) or by email to
jteresco AT mtholyoke.edu by the start of class. We will discuss these questions at
the start of class, so no late submissions are accepted.
- A function to return a darker shade of an HSV color.
(define (darkerHSV c)
)
- A function that generates a random RGB color.
(define (randomRGBColor)
)
- A function that returns one color (provided as a parameter) half
of the time (randomly) or a second color (provided as another
parameter) the other half of the time.
(define (pickAColor c1 c2)
)
So the function call (pickAColor red blue) would randomly return
either red or blue.
You may use the helper functions we defined in class examples such as
rand, first, etc.
Examples
- Countdown
- SaltShaker
- SaltAndPepper
- SpiceMix
- Doughnuts