big-bang 04

Setup:

(define (short n)
  (beside (rectangle (- n 20) 10 "solid" "yellow")
          (square 20 "solid" "goldenrod")))
(define initial (short 300))
(define (draw-h-4 m)
  (overlay/align "right" "bottom"
                 m (rectangle 300 200 "solid" "lightblue")))
(big-bang initial
  (on-draw draw-h-4)
  (on-mouse melody))
  1. What “kind of thing” is the model? (Same question, restated: what is the type of the model?)

  2. What is the signature of draw-h-4?

  3. Make an accurate drawing of the first image shown.

  4. What is the name and signature for the mouse handler?

  5. Write a check-expect for the mouse handler that shows that when the old model is initial and you move the mouse to coordinates (30, 75), the new model is demo1:

     (define demo1 (above (short 280) (square 10 "solid" "red")))
    

The purpose of the mouse handler is to make the “short” part 20 units shorter each time and keep one red square on the bottom.

  1. Make a model/drawing diagram with 3 columns showing the models in the top row (with mouse motion between them) and the result of applying the draw handler in the second row.
  2. Write a check-expect for the mouse handler, showing exactly what happens when you move the mouse with the old model being demo1.
Last modified August 18, 2023: 2022-2023 End State (7352e87)