In this assignment you will use universe to create a simple game. In this game you must pilot a rocket around invading aliens to reach "space" (the top of the screen).

Here is an example of how the game should look:

The Problem

When you are finished, your game should contain the following:

To make the assignment easier, you may want to break it up into simpler stages such as:

  1. Draw a rocket on the screen and have it move from the bottom to the top.
  2. Add UFOs drawn standing still at different starting x and y positions.
  3. Make the Rocket horizontally controllable by keyboard
  4. Make the UFOs move from left to right across the screen.
  5. Add collisions between the UFOs and the walls.
  6. Add collision detection between the UFOs and the rocket and add the flame-burst final scene.


Your test cases will be an important part of your grade on this assignment. You don't need to test the functions that produce graphical output; however, that just puts more burden on the non-graphical ones!


You will want the following clipart images:

Remember, you can insert an image into your Racket code by selecting "Insert Image..." from the "Insert" menu, or by copying and pasting an image into your code. Your definition of an image to use for drawing would look like:

(define MY-IMAGE )

The key primitive you will use is big-bang. You'll want a big-bang that reacts to key-presses, knows when to stop, can draw itself and continually moves the rocket. You may find the relevant chapter of How to Design Programs, second edition useful, as well as the Racket documentation on big-bang .

Remember to think about what you want in your world, and how you'll need to change your world before starting to program, and use the design recipe.

You will also find the Racket documentation on drawing your own images to be useful - especially on how to overlay one image above another in a given position.

For generating random numbers, look at the documentation on random here.

You shouldn't have to copy-paste any code. If you find yourself duplicating code, you make wish to rethink the structure of your world.

Finally, you may want to look through the fully worked-out example of a universe program (Flight Lander) in How to Design Worlds. Note that the text uses an older version of big-bang, so read it for the ideas and most, but not all, of the code.

What should my Racket code look like?

Your Racket should look like Racket, not Java. We expect you to follow the formatting conventions below:


You will again want the 2htdp/image.rkt Teachpack:

  1. You will want to disable the cs017 Teachpack; therefore, remove it from your list of Teachpacks (e.g., Language menu, Clear All Teachpacks).
  2. Go to the Language menu, select Add Teachpack..., and choose this Teachpack from the middle column.
You will likely find the documentation useful.

You will also want the universe.rkt Teachpack, which defines big-bang.

What to turn in:

Create a single Racket file, rocket.rkt, with code implementing the finished game. Turn it in using

cs019_supp_handin rocket
Note that you are using a different command than used for CSCI 0170, because the homeworks are being graded by different people.