On this page:
1 Preparation
2 Finger Exercises with Lists
3 The Invader Shoots Back
4 Many Invaders
5 Project submission
6.10

Assignment 6: Invasion!

Due: Friday, October 13, 11:59:59 PM EST.

The following should be completed in cooperation with your latest assigned partner. (Partner assignments are listed on Piazza.) You may not share code for this assignment with anyone but your partner.

You must use the design recipe and The Style guidelines to receive full credit.

We’ve created an assignment skeleton assign6.zip for you to edit, please download the archive and edit the files you find inside. You must not change any file names.

1 Preparation

Make sure you have read and studied all of Part II of HtDP2e.

2 Finger Exercises with Lists

Edit the file list.rkt for this part of the assignment. Add your information to the standard file header at the top of the file.

Complete exercises 143–148 from HtDP2e Part 2.

3 The Invader Shoots Back

Copy your code from the invader-shots.rkt in assignment 5 into the provided file invaders-shoot.rkt for this part of the assignment. Edit the standard file header at the top of the file. Submit only invaders-shoot.rkt for this part of the assignment, not the original invader-shots.rkt.

The fight between your base and the invader is a bit one-sided at this point. It’s far more sporting to let the invader shoot back.

Extend your program such that the invader shoots down toward the base.

Some questions to consider:
  • How does the game state that big-bang operates on need to change so the invader can fire arbitrarily many shots?

  • Which functions operate on the game state? How do they need to change to account for an invader that fires back?

  • Hint: Create a TODO list of all functions that need to change, then start working your way through that list.

4 Many Invaders

Continue this section in the same file as the last section (invaders-shoot.rkt).

Our TAs complain that the single-invader version of the game will be too easy for them. Modify your game to support a single row of an arbitrary number of invaders that can all shoot at the base.

Note:
  • It should be easy to modify the program to change the number of invaders in the row.

  • The whole row should move horizontally along the scene. Once the row meets the far left or the far right of the screen, the entire row should move down.

  • Knocking off the left-most or right-most invader doesn’t change how far left and right the row moves.

  • Each invader can shoot at its own regular interval. These intervals should vary invader-to-invader to make the game interesting.

Some questions to consider:
  • How does the game state that big-bang operates on need to change so the invader can fire arbitrarily many shots?

  • Which functions operate on the game state? How do they need to change to account for multiple invaders rather than a single row?

5 Project submission

You should submit both of the provided files: list.rkt and invaders-shoot.rkt.

Submit your files directly to the submit server by uploading them. Select each of these files individually using the “Browse” button. Once you have selected all the files, press the “Submit project!” button. You do not need to put them in a zip file.