PasteRack.org
Paste # 75085
2018-02-16 09:14:42

Fork as a new paste.

Paste viewed 116 times.


Embed:

  1. #lang racket
  2.  
  3. (require 2htdp/image)
  4. (require 2htdp/universe)
  5.  
  6. (define WIDTH 600)
  7. (define HEIGHT (* WIDTH (/ 2 3)))
  8. (define TEXT-SIZE 20)
  9. (define CTR-Y (/ HEIGHT 2))
  10.  
  11. (define MTS (empty-scene WIDTH HEIGHT))
  12.  
  13. (define CAT-IMG (rectangle 40 60 "solid" "brown"))
  14.  
  15. ;; ============================
  16. ;; Data definitions:
  17.  
  18. ;; Cat is Number
  19. ;; interp. x position of the cat in screen coordinates
  20.  
  21. (define C1 0)
  22. (define C2 (/ WIDTH 2))
  23. (define C3 WIDTH)
  24.  
  25. (define (fn-for-cat c)
  26.   (... c))
  27.  
  28. ;; Template rules used:
  29. ;;  - atomic non-distinct: Number
  30.  
  31. ;; ============================
  32. ;; Functions:
  33.  
  34. ;; Cat -> Cat
  35. ;; start the world with ...
  36.  
  37. (define (main c)
  38.   (big-bang c
  39.             (on-tick advance-cat)
  40.             (to-draw render)))
  41.  
  42. ;; Cat -> Cat
  43. ;; produce the next cat by advancing it 1 pixel to the right
  44. ;; !!!
  45. (define (advance-cat c) 0)
  46.  
  47.  
  48. ;; Cat -> Image
  49. ;; render the cat image at appropriate place on MTS
  50. ;; !!!
  51. (define (render c) MTS)

=>