| 6.170 |
Laboratory in Software Engineering
Spring 2004
Final Project Amendment: Poly-Gizmos
|
Handout F5
Contents:
Background
The staff members in charge of acceptance testing have enjoyed using
your initial implementation. We have decided, however, that the
pinball game needs to be extended. First, we want to be able to
create boards with multiple balls since we are unchallenged by only a
single ball on the board. Second, we would like to be able to create
bumper gizmos with arbitrary polgygonal shape that the ball can
interact with.
You must extend Gizmoball to support arbitrary polygonal bumpers and
multiple balls.
Multiple Balls
You must now support multiple balls. This requires no change to the
file format, except that there can be multiple "Ball" commands each
correponding to a new, different ball. In build mode, you must allow
the user to place multiple balls on the board, and in run mode these
balls must realistically interact. The behavior of the absorber is
now underspecified. You will need to specify absorber behavior when
multiple balls interact with an absorber and write this up in your
final write-up.
Note: We are allowing you to maintain a default (and
unmodifiable) size and mass for each ball that is placed on the board;
you therefore do NOT need to support arbitrary ball sizes and
densities. If you choose to support larger balls, however, make sure
to make a (reasonable) modification to absorber behavior.
Poly-Gizmos
Your Gizmoball game must now support static bumpers with arbitrary
polygonal shape. The ball will interact with these "Poly-Gizmos" just
like the triangular, square, and circular bumpers. You will be
required to load Poly-Gizmos from XML files, but you are NOT required
to provide GUI support for creating arbitrary Poly-Gizmos (though we
encourage you to think about how to do so and make an attempt if you
have time!)
File Format
In order to create and place Poly-Gizmos, a new element has been added
to the provided XML schema. Here is a sample file using the new
polyGizmo element and polyGizmoVertex sub-elements:
<board>
<gizmos>
<!-- define an OCTAGON! :-) -->
<polyGizmo name="PG13" x="1" y="2" width="3" height="3">
<!-- vertex locations are RELATIVE to polyGizmo x,y -->
<gizmoVertex x="1" y="0"/>
<gizmoVertex x="2" y="0"/>
<gizmoVertex x="3" y="1"/>
<gizmoVertex x="3" y="2"/>
<gizmoVertex x="2" y="3"/>
<gizmoVertex x="1" y="3"/>
<gizmoVertex x="0" y="2"/>
<gizmoVertex x="0" y="1"/>
</polyGizmo>
</gizmos>
</board>
The format of the element is similar to the squareBumper and
circleBumper elements:
<polyGizmo name="STRING" x="INTEGER" y="INTEGER" width="INTEGER" height="INTEGER" />
<gizmoVertex x="INTEGER" y="INTEGER"/>
If you would like to use an updated schema (with references to
polyGizmo and gizmoVertex), you can find it here.
Sample Boards
We provide a sample board (given in the
standard file format) to illustrate one of the many possible
configurations your clients expect to be able to create and play using
these new features.
Ambiguities
Parts of this amendment have been left intentionally vague. It is
up to you to decide what (if any) clarifications are necessary. You
should include any changes to your Revised Specification documentation
in your final submission on 5/11/2004.
Design Decisions
Spend some time thinking about the best way to incorporate this change
into your design. In your final design write-up, be sure to discuss
the changes to your initial design (and the relevant trade-offs).
You will be graded on how easily your initial design can support the
amendment, and how cleanly you incorporate the amendment into your design.
Hints
- A suggested implementation order is multiple balls, then poly-gizmos.
- Look at the Polygon class in the Java API for some inspiration for
how to draw the arbitrary polygon shapes on the canvas.
- Before designing your Poly-Gizmo ADT, make sure your physics loop
handles generic bumpers well.
Back to the problem sets page.
For problems or questions regarding this page, contact:
6.170-webmaster@mit.edu.