Computer Science 15-110, Lecture 9 (Sections M-Q), Fall 2009
Lab 6 (Midterm + Snake!)
Due: Thu 22-Oct-2009 at
10pm (email copy to your CA)
(no late submissions accepted).
Read these instructions first!
- The lab instructions from
lab2
all apply here.
- As explained in that document:
- Submit your free-response answers in a
single file named Lab6.txt (or .doc, .pdf, .rtf, or .html -- but not
.docx!).
- Your top-level directory (which must exist)
should be named lab6-<andrewId>. Submit a zipped version of this.
- Do not submit .java~ files, .class files,
project files, or any other extraneous files.
Place all your non-graphics, non-bonus
answers in the file Lab6.java.
- While collaboration is not required on this
lab, it is very strongly encouraged.
Programming guidelines:
- Style counts!!! Use well-named variables,
proper indenting, reasonable commenting, etc.
- There are no limitations on what Java concepts you
use at this point in the course.
- Midterm Redux
- Snake Extensions
-
Bonus/Optional: More
Snake Extensions
- Midterm Redux
Working in a group
(this is a lab, after all), write a solution set to
midterm #1. Include your answers in the free-response portion (in
Lab6.txt, or whatever extension you use).
-
Snake Extensions
In the file Lab6Snake.java, add the following features to the game of
Snake that we wrote in class (here is Snake.java as
we wrote it (well, with one bug fix!)):
- Multiple moves per timer event
As written, the snake only moves on timer events. So, for example,
if you hit RIGHT then UP very quickly (in less time than a single timer
event delay), then the snake will not go right then up, but only up (the
last direction pressed). Fix this so that you can rapidly make several
moves between timer fired events.
- Snake traps
Snake traps work just like food, only they are painted red instead of
green, and the snake dies if it crawls into one. Also, each time the
snake eats another morsel of food, another snake trap is placed randomly
somewhere (so at first there is one snake trap visible, then two, then
three,...).
-
Bonus/Optional: More
Snake Extensions
In the file Lab6SnakeBonus.java, add the following additional features to
the game of Snake that we wrote in class:
- Simple features
(do whichever you like -- each is worth 1/2 point up to 3 points max, if
done really well)
- A score.
- A countdown timer.
- Multiple snake lives.
- A high score file.
- A splash screen (at the start of the program) and a game over
screen.
- A help screen.
- More challenging features
(each worth 1 point up to 6 points max, if done really well)
- Impediments (walls, traps, etc).
- Eagles (they attack and eat snakes).
- Portals (as the snake enters a portal, it magically teletransports
to emerge from a different portal, so for a while there are two partial
snakes on the board)
- Two players (one gets arrows, the other gets AWSZ or some such).
- Significantly better graphics and sounds.
- Levels with increasing challenges (faster play, more impediments,
smarter eagles, etc)
Be creative!!! Have fun!!!
Carpe diem!