60 likes | 146 Views
GBK Programming 1. Jordan Johnson. Today’s plan. Greeting Review Hand Tracing Finish Traffic Light Program Variant Data, continued: Itemizations Journal HW Clean-up. Warm-up.
E N D
GBK Programming 1 Jordan Johnson
Today’s plan Greeting Review Hand Tracing Finish Traffic Light Program Variant Data, continued: Itemizations Journal HW Clean-up
Warm-up By hand, trace the evaluation of (sqrt (+ (sqrx) (sqr 5)))if x is defined as 10, sqrt is the square-root function, and sqr is defined by (define (sqrn) (* nn))
Problem: • Develop a simulation of a traffic light. • Requirements: • Track the light’s current color. • Update the light in response to user input,using the usual progression: • green yellow red green • So far: • Defined the data • Created the key handler • Need the draw function & big-bang hookup
More complex variant types ;; AKeyEventis either... ;; - a str1 ;; - “release” ;; - “up”, “down”, “left”, “right”, “home”, “end” ;; - “prior” or “next” (representing PageUp/PageDown) ;; - “f1”, “f2”, “f3”, ..., or “f24” ;; - “numpad1”, “numpad2”, ... “numpad0” ;; - ...(or any of a number of more obscure key names) ;; A str1 is a string containing one keyboard character, ;; which may be a special one like “\b” (backspace), ;; “\t” (tab) or “\n” (Enter) We can use higher-level definitions and refer to other definitions, too:
Clean-up • Before you leave, please . . . • Log out. • Push in your chair. • Make sure you’ve got everything. • Make sure all trash ends up in the trash can.