big-bang 02

You should be familiar with the importance of check-expects before doing the exercises.

Long Leg Triangle

The first animation code is below.

(define (left-mid img)
  (overlay/align "left" "middle" img (empty-scene 350 250)))
(define initial-model
  (right-triangle 200 100 "solid" "blue"))
(big-bang initial-model
  (on-mouse ...to-write...)
  (to-draw left-mid))
  1. Sketch the first image shown when the code is run. (Commit to your best guess before testing it.)
  2. What kind of “thing” is the initial model?

Mouse Handler 1

The purpose of the mouse handler my-mouse is to create a triangle with width equal to the x-coordinate of the mouse but with the height always 100.

  1. Write a check-expect showing the result when the mouse moves to the point (150,75).

     (check-expect (my-mouse initial-model 150 75 "move") ...)
    
  2. Write another check-expect that has everything different from the one above. (Every single input, and the output.)

Mouse Handler 2

Now we write another, different mouse handler. The purpose of this mouse handler, slide-handler, is to make it seem like there is a large triangle extending off the left side of the screen that slides back and forth on the screen so that the tip of the triangle is at the x-coordinate of the mouse.

  1. Write a check-expect for slide-handler.
  2. Write a totally different check-expect for slide-handler.