Turn your solution to problem 10.2 into an stateful data representation.
Use the following revised main function to launch the game:
;; space-invader-state% -> Nat
;; launch a space invader game, use sis0 as initial state
;; space-invader-state% -> Nat
;; launch a space invader game, use sis0 as initial state
(define (main sis0)
(big-bang 0
(on-tick (lambda (x)
(begin
(send sis0 move)
(+ 1 x))))
(on-key (lambda (x ke)
(begin
(send sis0 react ke)
(+ 1 x))))
(on-draw (lambda (x) (send sis0 render)))
(stop-when (lambda (x) (send sis0 win-or-lose)))))
This interface dictates what pieces of the representation must become
stateful and which pieces may remain applicative. See HtDC. Stick to this
minimal approach to statefulness.
Change the game so that the UFO drops bombs and thus tries to destroy the
tank on the ground. To keep things simple, the UFO drops a bomb randomly,
specifically at a chance of "1 out of 10" per clock tick. The bombs drop
straight down at a speed that is at least twice as fast as the UFO's. When
a bomb is close enough to the tank, the tank is destroyed and the game is
over.