CSC151.02 2015S, Class 39: Randomized (Unpredictable) Drawing
=============================================================

* Continue Partners!

_Overview_

* Preliminaries.
    * Admin.
    * Upcoming Work.
    * Extra Credit.
    * Questions.
* Quiz.
* Lab.

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

### Admin

* Welcome to our admitted student.
* Given where I found Corn Nuts, I may never bring food again.
* Review session Monday at 7pm.
* It's nearly prereg time.  Think about taking 161 in the fall!
* A friendly reminder: If you miss class, you do have an obligation to
  send me a note.
* If you have three large things due next week (including the 151 exam),
  and you think some extra time would help, please let me know.  
    * But remember that you'll be starting on the project!

### Upcoming Work

* Lab writeup: Exercise 4c
  <http://bit.ly/151-2015S-lab39>
* Readings for Monday: 
    [Elements and Principles of Two-Dimensional Design](../readings/design-elements-reading.html) and
    [About the Project](../assignments/project.html)

### Extra Credit Opportunities

#### Academic 

* CS Extras next Thursday: Nora Bressette Buccino on her summer REU
  (Android and Robots!)
* CS Table next Friday: TBD.

#### Peer Support (Afternoon Section)

* Womens Tennis Sunday at 3pm against Central.
* ISO Show, Saturday night 7-9 pm at Harris.  Many live performances.
* How an admitted student this coming Sunday night (or the following
  Sunday night)!  Contact JMU for info.
* Psych Alum talks next Tuesday and Thursday, probably 4:15pm.  Learn
  more on Monday.
* Contra Dance Workshop Thursday the 16th at 7:30 pm in BCA Dance Studio.
* Salsa Showcase Harris 7:30ish on Friday the 17th.
* More things to be announced next week!

#### Miscellaneous

* Town hall April 23, noon or 7:30 pm, "How we have conversations."

### Other Good Things (no extra credit)

_None_

### Questions on the exam

_Can we copy `turtle-line!` directly into our exam code?_

> Yes!  (You might even cite it, but you are not required to because
  it appears in the exam.)

### Questions on other issues

_Is `(cons 'a 'b)` the same as `(list 'a 'b)`?_

> No

Quiz
----

* If you finish before your partner, bring up DrRacket and the reading

Lab
---

Extra credit to the first person who can explain why I want to say
"Rawhide!" during lab.

Multiple strategies for `tally-seven-eleven` (forthcoming)

* Use a `let` to name the roll

    (define tally-seven-eleven
      (lambda (n)
         (cond [(<= n 0) 
                0]
               [(let ([roll (pair-a-dice)])
                  (or (= roll 7) (= roll 11)))
                (+ 1 (tally-seven-eleven (- n 1)))]
               [else 
                (tally-seven-eleven (- n 1))])))

* Use a `let` to name a procedure that checks whether a roll is 7 or eleven

    (define tally-seven-eleven
      (let ([seven-or-eleven? 
              (lambda (val) (or (= val 7) (= val 11)))])
        (lambda (n)
           (cond [(<= n 0) 
                  0]
                 [(seven-or-eleven? (pair-a-dice))
                  (+ 1 (tally-seven-eleven (- n 1)))]
                 [else 
                  (tally-seven-eleven (- n 1))]))))

* Use `member?`

    (define tally-seven-eleven
      (lambda (n)
         (cond [(<= n 0) 
                0]
               [(member? (pair-a-dice) (list 7 11))
                (+ 1 (tally-seven-eleven (- n 1)))]
               [else 
                (tally-seven-eleven (- n 1))])))

