Big-bang returns zero

I am following through the book of "Realm Of Racket" and typed in exactly as it is on the book a landing a UFO animation everything seemed to work until i put in the code for stopping the programming.Specially this part "state-is-600"

(define (state-is-600 current-state)
(<= current-state 600))

(big-bang 0
(on-tick add-3-to-state)
(to-draw draw-a-ufo-onto-an-empty-scene)
(stop-when state-is-600))

i did make the sure the codes were written correctly and formatted appropriately,and all it does is return zero each time i run the program any suggestions please.Here is the full code

#lang racket

(require 2htdp/universe 2htdp/image)

(define WIDTH 600)
(define HEIGHT 600)

(define (add-3-to-state current-state)
( + current-state 3))
(define (draw-a-ufo-onto-an-empty-scene current-state)
(place-image IMAGE-of-UFO (/ WIDTH 2) current-state
(empty-scene WIDTH HEIGHT)))

  (define  IMAGE-of-UFO  .)

(define (state-is-600 current-state)
(<= current-state 600))

(big-bang 0
(on-tick add-3-to-state)
(to-draw draw-a-ufo-onto-an-empty-scene)
(stop-when state-is-600))

disclaimer: MAGE-of-UFO does have an image it wont let me copy the image

Do you want >= instead of <= in state-is-600?

The code in the book is available in the installed Racket download: File -> Open Require Path -> enter: realm -> collects/realm. Now choose a chapter.

1 Like