CSC151.01 2014F, Class 11: A Design Perspective
===============================================

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
* Discussion of Quiz 2
* Discussion of Homework 3
* Discussion of Testing
* Colors (and design)!
    * A bit about design.
    * A bit about color theory.
    * Exploring some images and design spaces.

Preliminaries
-------------

### Admin

* No lab partners today.  Sit wherever you want.
* My goal is no more than four hours per person on homework assignments.  
  I know some subset of you have spent more than that and are still 
  working on the homework.  We will talk about it in class.
* Because of recent problems, we will probably spend very little time on
  the official topic of today (design and color).  We will instead spend
  time talking about quiz 2, homework 3, and testing.
* HW 2 will be returned tonight.

### Upcoming Work

* No lab writeup (for yesterday or today).
* [HW 3](../assignments/assignment.03.html) due tonight.
* Exam 1 to be distributed tomorrow.
* Readings for Wednesday:
    * [Raster Graphics](../readings/raster-graphics-reading.html)
    * [RGB Colors](../readings/rgb-reading.html)

### Campus Events of Interest

* Rosenfield seminar on Scotland, Tuesday noon and Thursday afternoon.
* Rebecca Hamlin book talk Wednesday at 4:15 pm.
* Internship talks Wednesday and Thursday afternoons.

### Extra Credit Opportunities

#### Academic

* Convocation Wednesday: President Kington
* CS Table Friday: Browser Tracking

#### Peer Support

* Football Games (???)
* Women's Volleyball (???)
    * Congrats on three victories this weekend!
* Men's Tennis (???)
* Women's Tennis (???)
* Anna Christie, Oct. 9-12 (SB plays Marthy)

Discussion of Quiz 2
--------------------

Sketch or describe the final image that results from evaluating the
following series of Scheme expressions. Your answer should clearly
indicate the color, size, and position of each shape.

        (define d1 (scale-drawing 20 drawing-unit-circle))
        (define d2 (hshift-drawing 30 d1))
        (recolor-drawing "red" d1)
        (recolor-drawing "blue " d2)
        (image-show (drawing->image (drawing-group d1 d2) 50 50))

At times, it is useful to find the center of a drawing.  The center
of a square, rectangle, circle, or ellipsoid is a point whose x
coordinate is midway between the left edge and the right edge, and
whose y coordinate is halfway between the top edge and bottom edge.
There are many possible definitions of the center of a compound drawing;
but the "halfway" rule works as a starting approach. Write a procedure,
(drawing-center-x drawing),  that returns the x coordinate of the center
of a drawing, using the halfway rule.  For example,

        > (drawing-type my-cool-drawing)
        'group
        > (drawing-left my-cool-drawing)
        10
        > (drawing-width my-cool-drawing)
        40
        > (drawing-center-x my-cool-drawing)
        30 ; The left edge is 10, the right is 50 (10 + 40)
        > (drawing-left small-square)
        0
        > (drawing-width small-square)
        1
        > (drawing-center-x (drawing-group my-cool-drawing small-square))
        25 ; The left edge is 0, the right edge is fifty

* Lesson one for Sam: Write less.

Finish the definition below

        (define drawing-center-x

Discussion of Homework 3
------------------------

I was talking to a student about combinatorics and noted that CS and
math share a characteristic that for some problems, you need a moment
of insight.  We know that you are just developing skills as problem
solvers, and try to lead you to that insight.  We also try to help you
develop general processes.

With that said, let's consider two key ideas that might help you solve
the neighbor problems.

* Key idea one: *Work with sample data to understand the problem and how
  you might reach a solution.*  [General process]
* Key idea two: *Shift the original so that it's in the top-left of the
  positive plane.*  [Problem-specific insight]
    * From the assignment: "You might choose to temporarily shift the 
      drawing back to the left margin and then shift the pair back 
      after making the neighbor."

We'll start with a circle of radius 40, centered at 120,80.

* *Determine the goal.*
  Suppose we are scaling by 75%.  Where does the right neighbor go?
* *Solve simpler problem.*
  Suppose the original circle has its left edge at 0 and its top edge
  at 0.  
    * Where does the right neighbor go?
    * If we just scale the circle, where does the right neighbor end up?
    * How do we get the right neighbor to the right place?
* *Convert original problem to simpler problem.*
  How do we get the original circle to the corner?
* *Convert solution to simpler problem to solution to more original 
  problem."
  How do we get the neighbor from where it is to where it goes?

Discussion of Testing
---------------------

* Idea: We want some assurance that a procedure is correct.  We build
  a test/protocol that the computer can use to check correctness.
* Lab approach: You have a bunch of incorrect procedures that all try to
  do the same thing.  A good test/protocol should identify which are 
  incorrect.
* Some things that worked during class:
    * `(classify-triangle 1 1 9) ; not a triangle, should get an error`
    * `(classify-triangel 2 3 2) ; should be isosceles`
* Let's look at which those catch.

Colors (and design)!
--------------------

### A bit about design

### A bit about color theory

