CSci 1301: Lab 6
Due: Friday, November 4th 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 6" 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: balloon problem (30 points)
Start with the balloon
exercise and implement the world functionality.
Specifically:
- Start with a fixed list of balloons as the world state.
- 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.
- 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).
- Change the function that you call on tick to move all the balloons up by a fixed distance.
- 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.
- 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.
- 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 with some probability rather than on every clock tick
(to avoid filling up the screen too quickly). 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.
Avoid solutions that require a change to the world state.
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.