CSci 1301: Lab 5

Due: Wednesday, November 5th at 11:59pm by e-mail

What to submit

The lab is done in groups of 2. In the beginning of each file please write (in comments) the names fo all group members.

At the end of the lab please send me and your group partner(s) all your Racket files as e-mail attachments. My e-mail is elenam at morris.umn.edu. The subject of your e-mail must be "1301 Lab 5" followed by "Final" or "Not final", depending on whether this is a final submission or you are still working on it. If you need to finish it, make sure to set up a time with your group partner(s) to finish the lab.

Task 1: Finish the balloon problem (30 points)

Your task is to continue the balloon exercise that we started in class. Specifically:

  1. Start with a fixed list of balloons as the world state.
  2. Add a function show that draws all balloons in the list on the canvas. Your on-tick function can just be do-nothing at this point.
  3. Once you get it to work, change the initial state to a function call that generates a list of balloons at random positions at the bottom of the screen with a random size (i.e. the scaling factor) between 0.5 and 1.5 and of a random color (use your own colors; you may want to change the color chooser to randomly choosing from a list of colors).
  4. Change the function that you call on tick to move all the balloons up by a fixed distance.
  5. Further change it so that when a balloon disappears from the screen, it is removed from the list. You should write a predicate is-visible? that checks if a balloon is still visible on the canvas. This feature is very important for writing games: if you don't remove invisible objects, you get too many of them and your game starts slowing down.
  6. Further change the function that you call on every tick, to add a new ballloon at the bottom of the canvas on every clock tick.
  7. Change your solution by adding an additional feature (you may change your solution to the previous question; comment out the old code, but don't delete it. You can add features such as: adding a new balloon less than on every clock tick (you can make it deterministic, such as adding one on every 2nd clock tick, or probabilistic, such as adding a balloon with a probability 1/2). You can add "wind" that makes balloons shift horizontally, in addition to vertically. You can have a balloon pop at random, or when it hits a tree branch.
    Especially interesting solutions may get an extra credit.
    Clearly document the features that you are adding. Make sure that your functions have good names and signatures and descriptions.

CSci 1301 course web site.