CSC151.01 2014F, Class 33: Turtle Graphics
==========================================

*New partners!*

*Candy!* (one piece each, please)

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions (HW, Admin).
* About Turtle Graphics.
* Quiz!
* Lab.

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

### Admin

* It's Friday.  Please consider what things you would and would not like
  to do this weekend, and do not feel pressure to behave differently.
  If you choose to partake, please partake responsibly.
* Preregistration starts next week.  Those of you who find that you are 
  enjoying 151 (or at least some aspects of CS) might consider taking 
  another course.  Those of you who are particularly committed to CS
  might want to consider more than one course.  
    * CSC 161 is the normal next course in our introductory sequence.
      It takes a much more imperative approach to programming (like the
      ! procedures we've been working with) and uses robots as one of
      the problem domains.  It's taught in a similar format to 151 (readings
      and labs), although there are also differences (e.g., in-class exams).
    * Those of you who are really enjoying the kinds of thinking we do for
      recursion might enjoy MAT/CSC 208, Discrete Structures, which explores
      the kinds of math relevant to CS.
    * If you're interested in the ways in which you build technologies
      that people can use, you might be interested in PSY/TEC/CSC 232,
      Human-Computer Interaction (2 credits).
    * If you have strong math skills (at least Linear), you can also
      consider CSC 262, Computer Vision.  In that course, we explore
      how you take the grids of pixels we think about in 151 and extract
      data from them.
* Since we're having a quiz today, we'll do questions on the reading
  before the quiz and start the lab immediately after the quiz.

### Upcoming Work

* Lab writeup: Extra 1 (due Monday): <http://bit.ly/151-2014F-w33>
* Reading for Monday:
  [Iteration](../readings/iteration-reading.html)
* [Homework 6](../assignments/assignment.06.html), due Tuesday.
* Exam 3, distributed this coming Wednesday, due the following Tuesday.

### Extra Credit Opportunities

#### Academic

* CS Extra Next Thursday: Study-Abroad Opportunities with a CS Component
* CS Table Next Friday: Open Data

#### Peer Support

* Noteworthy is going to be performing at 9:00 PM at Herrick Chapel tonight (Friday the 31st).
* Swimming scrimmage 9am on Saturday
* Football (Saturday at 1pm)
* Karan's radio show 11pm Thursday nights on KDIC
* Evan's radio show 5pm Friday nights on KDIC
* Donna's radio show Sunday midnight on KDIC

### Questions (Administrative, HW6)

About Turtle Graphics
---------------------

Two minutes, two questions:

* What are the two most important points from the reading?
* What is the murkiest part of the reading?

Important points

* Turtles are procedures.  
    * Can I write `(tommy 'go-forward!)?`  No!
* But they get used as "regular" values
    * `(turtle-forward! tommy 23)`
* Turtles can draw thing.
* We have a `repeat!` command
* Turtles have a variety of capabilities.
    * And reference pages exist for a reason.
    * Among options: Forward, reset position, change color, ...

Murkiness

* Will we ever use turtles with recursion?  Yes.
* Turtles are procedures (or seem to be procedures).  Do we have to
  define them?
    * No.  You probably can't.
    * It's actually not important that they are procedures (even though
      Sam wrote that above).  They are procedures only so that you 
      cannot see the implementation.  (Good design habit.)
    * You get turtles with `turtle-new` and `turtle-clone`.
* How does `repeat!` work?
    * You know that `(map proc (list 1 2 3))` means call `(proc 1)`,
      `(proc 2)`, `(proc 3)` and then shove them into a new list.
    * Repeat is similar. `(repeat N proc val)` means calls `(proc val)`
      `(proc val)`, `(proc val)`, `(proc val)`, `(proc val)` N times.
      Returns nothing.  Similar to `(map proc (make-list N val))`, but
      without the list (also more efficient).
* Is `(repeat 3 proc val)` the same as `(map (o proc proc proc) (list val))?`
    * An interesting idea.  But no.  The first does `(proc val)` three times.
      The second does `(proc (proc (proc (val))))`.
* Can you explain `turtle-up!` and `turtle down`?  And what's the default?
    * Up means "don't draw when you move forward"
    * Down means "draw when you move forward"
    * Starts down.
* Can we shade an area with a turtle?
    * Not now.  Ask Sam for evil code.
* Can you go over the functional vs. imperative distinction?
    * Functional: Build new values from old; functions have a goal
      of building new values.  Often, order of operations does
      not matter.  E.g., you can square either of 2, 5, and 10 first
      in `(+ (square 5) (square 10) (square 2))`.
    * Imperative: Change the "state" of the system.  Things like
      `image-stroke!` and `image-select-ellipse!`.  Need to think
      about explicit sequencing - order of steps matters.

Quiz!
-----

* Yay!  Recursion!

Lab
---

* Yay! Pictures!
* Boo!  Sam didn't give us enough time.
    * (Or is that "Boo!  It's halloween.  Be frightened!"?
* But yes, you should finish it on your own.
* When working with trish, use 
  `(context-set-brush! trish "2. Hardness 100" 20)`
