[racket] Bothersome solution to HtDP/2e Rocket Landing Discussion

From: Lawrence J Winkler (winkllj at acm.org)
Date: Sun Feb 23 16:14:34 EST 2014

I recently starting reading HtDP/2e to evaluate the approach to teaching programming. My motivation, in part, stems from the recent Computer Science Education Week last December, where many were given the opportunity to experience one hour of programming. 

I'm interested in reviewing different teaching approaches and processes and I soon came upon your rocket landing demo in the Prologue and felt uncomfortable with the discussion and solution create-rocket-scene.v3. (I haven't read much further than this in any detail, so you may already address this issue later). 

In particular, the solution adjusts the position of the rocket relative to the HEIGHT of the empty-scene and the image-height, whereas I'm much more comfortable with a solution conceptualized differently and independent of size of the  scene.

Where in the function (create-rocket-scene height), height is the position of the center of the image, my solution is that height would be the height of the bottom of the image. Thus, something like the following makes more sense to me. (using BSL) 

(define (place-image-bottom img x y canvas)  
 (place-image img x (img-center-pos img y) canvas))

(define (img-center-pos img vert-pos) (- vert-pos (/ (image-height img) 2)))

(define (create-rocket-scene.v3 ht)
 (if (<= ht 100) (place-image-bottom rocket 50 ht (empty-scene 100 100))
     (place-image-bottom rocket 50 100 (empty-scene 100 100))))

In any case, it would seem easier for me to motivate this abstraction to new students. 

Larry Winkler
5306 Loruth Ter
Madison Wisconsin 53711
Mobile: 608-345-0627

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140223/fffb8901/attachment.html>

Posted on the users mailing list.