Please send questions to st10@humboldt.edu .

; DON'T EXECUTE THIS TEXT VERSION -- it has a dot where
;    MY-CAR's image should be! 8-)

; create an animation of a car moving right across 
;    the scene and then stopping

(define MY-CAR .)

(define WIDTH 300)
(define HEIGHT 200)
(define BACKDROP
	(place-image 
         (rectangle  WIDTH (/ HEIGHT 10) "solid" 
                     "gray")	           
         (/ WIDTH 2)
         (- HEIGHT (/ HEIGHT 20))
         (empty-scene WIDTH HEIGHT)))

(define CAR-Y (- HEIGHT (/ HEIGHT 10)))

; contract: create-car-scene: number -> scene
; purpose: expects a time-counter, and if the 
;          time-counter is less than WIDTH,
;          then produces a scene with a car
;          centered at (time-counter, CAR-Y);
;          otherwise, it produces a scene of
;          a car centered at (WIDTH, CAR-Y)

;(define (create-car-scene time-counter)
;	...
;)

(check-expect
	(create-car-scene 100)
	
	; what scene SHOULD be created when this 
        ;    is called with 100?
	; ...a scene with a car at (100, CAR-Y)

	(place-image MY-CAR
			100
			CAR-Y
			BACKDROP)
)

; how about a BIG time-counter value? say 1000?

(check-expect
	(create-car-scene 1000)
	(place-image MY-CAR
			WIDTH
			CAR-Y
			BACKDROP)
)

; see how you have two CASES here?
; NOW the step 4, TEMPLATE step, can be useful;
; IF I have cases, I COULD very well have a cond expression
;    as the body of my function,
; and why don't I go ahead and PUT the "skeleton" of that
;    cond into my function body?
; with a [... ...] pair for EACH case?
;    (you might improve, or refactor, this later,
;    but this is a reasonable start;)

; for THIS function, this is the result of the template step:
;(define (create-car-scene time-counter)
;  (cond
;     [... ...]
;     [... ...]
;  )
;)

(define (create-car-scene time-counter)
  (cond
     [(< time-counter WIDTH) 
         (place-image MY-CAR
                      time-counter
                      CAR-Y
                      BACKDROP)]
     [else (place-image MY-CAR
                        WIDTH
                        CAR-Y
                        BACKDROP)]
  )
)

(animate create-car-scene)