Computer Science
15-111 (Sections A & B), Spring 2007
Homework #6: Bonus [ Up to 10 points]
Due: At
hw6 deadline (see note)
Note: This is BONUS. It is entirely OPTIONAL. You do not even have to read this document if
you do not wish to do so.
Note: These are due at the hw6 deadline,
except: if you have made substantial
progress (that you can demonstrate to your CA or instructor) on #3, but it is
not quite ready for submission, then you may continue working just on that
portion until the hw7 deadline (although there may be another interesting bonus
opportunity for you to work on then…).
1. Flags of the World [up to 3 pts]
Make a Java program, Flags.java, that draws various flags of the world as noted
below. Each flag should be drawn to fill
the window as much as possible while maintaining the correct rectangular
proportions, with the country name painted below it, and with two buttons below
that – “Next Flag” and “Previous Flag”.
Your flags should resize properly when the window is resized by the user. Your program should also be written according
to our Style Guide. In particular, you
should use top-down programming and reuse methods as much as possible to
simplify the problem. Also, you must use
loops where appropriate (say, in finding the endpoints of a 5-pointed
star). For full credit, you should
reproduce the flag as accurately as practicable (they do not have to be “pixel
perfect”, but they should be close – so, for instance, replacing stars with
circular blobs will not suffice for more than ˝ credit for that flag). To do this, you will need to use a few
Graphics, or even 2DGraphics, methods that we have not covered in class (such
as drawRect, fillPolygon, and others).
You should be resourceful in learning about these methods (via the online
Java API) and in finding examples or tutorials, if necessary, to learn how to
use them.
Note: You may not use any images (jpeg’s, gif’s, etc). You must do all the painting yourself in your
custom component’s paintComponent (or any methods it calls).
Note: For a larger version of these
flags, and to see other interesting flags, go to the CIA World Factbook’s Flags
of the World web site, or follow the links below.
Note: These flags were chosen strictly
for their graphical qualities, with no regard to the countries they represent.
a. [1 pt]: Include the following countries:
i.
Algeria
ii.
Grenada
Note: you can take some liberties with
approximating the yellow “nutmeg pod” in the left-hand green triangular field.
b. [1 pt]: Include the following countries:
ii.
Cook
Islands
c. [1 pt]: Include the following countries:
i.
Gibraltar
2. Bonus Lecture: How To Write a (Very
Simple) Text Adventure [1 pt]
Attend the entirely optional Bonus Lecture on “How to Write a (Very Simple) Text
Adventure” on Mon 19-Feb-2007 from 5pm to 6pm in Wean Hall 5419-D. You get 1 bonus point just for participating
(but not if you arrive late or leave early, or otherwise do not actively
participate).
If you would like to get an idea about what this means (seeing as few of you
have probably spent much, if any, time using these once-revolutionary but now
“quaint” games), give these a whirl (noting that they are way beyond anything we might accomplish in a week or two of bonus
work in a 100-level course!). Type
“help” for some help. Have fun with
them!
a. Zork (with downloads for Mac and
PC and an online version). This is one of the best examples of early
text adventures. It was wildly popular
in its time.
b. Scott Adams
Adventures (not to be confused with Scott Adams of Dilbert fame), with a Java applet of
Adventureland, and a site (freearcade.com) with a bunch of Scott
Adams adventures (and, unfortunately, lots of annoying advertisements…). These were my favorite early text
adventures. While they are simple by
modern standards, you should be warned that they can be rather addictive. J
3. Text Adventure [up to 6 pts]
Note: You can only submit a text
adventure if you attend the optional bonus lecture on “How To Write a Text
Adventure”.
Write an original text adventure based on the approach described in the bonus
lecture. For full credit, while
understanding that you can only do so much in the time allotted, you still must
have a reasonably rich, clever, and original story line, with well-written room
descriptions, a reasonably broad range of verbs and nouns, a somewhat
functional help system, and at least a modicum of real user-testing (have your
roommate play it for half an hour and provide some comments on the game). Most of all:
have fun!!!