CS 5010 F '09
 
Pair Programming
The Recipes
The Style
Subversion
Assignments
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
Set 7
Set 8
Set 9
Set 10
Set 11
Set 12

Problem Set 11

logo

Due date: 12/02


Purpose:

The second part of this assignment is about turning a data representation into a stateful representation and adding data and functionality to an object-oriented program.


Drill:

HtDC: Ignore all problems that ask you to draw things.

Required Problems:

Note: You must use the Module language level in DrScheme and you must use the language #lang scheme.


  1. There are no changes required to your solution to problem 10.1.
  2. 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.


last updated on Wed Dec 2 17:58:10 EST 2009generated with PLT Scheme