Thursday February 23rd
1. Discuss the article
on Pair Programming.
2. Answer any last minute questions about today's quiz.
3. Demonstrate the animation written last class in DrScheme:
(define (X t)
(+ (* 10 t) 20))
(define (Y t)
(+ (* 20 t) 60))
(define (ufo-paint t c)
(and (draw-solid-disk0 (X t) (Y t) 10 c)
(draw-solid-rect0 (- (X t) 20) (Y t)
40 3
c)))
(define (ufo-draw t) (ufo-paint t 'green))
(define (ufo-erase t) (ufo-paint t 'white))
(define (tock t)
(draw (ufo-erase t)
(ufo-draw (+ t 1))
produce (+ t 1)))
(start 100 200)
(big-bang .5 0)
(on-tick-event tock)
4. The produce keyword from last class allows us to assign a new
value to t, namely 1 more than t currently is. In programming, this is
referring to as assignment, so (produce (+ t 1) is an assignment
statement. (Assigment statements can be done in Scheme, or any other
programming language, but it cannot be done in the
Beginner's Version of Scheme that we have been using, without the
teachpack.)
5. Do exercise 1.3.1
A) Find out how tock in that figure works manually. Enter expression
expressions such as (tock 0) and (tock 1) into DrScheme's Interactions
window and see what their results and their effects on the canvas are.
Hint: Execute the animation but comment out the expression (on-tick-event
tock).
B) Make the UFO animation slower and/or faster.
C) Render the UFO as a yellow shape. Add an antenna. Make the background
blue.
D) Swap the two drawing actions in tock. Does this make a
difference? Why?
Why not?