Homework 3

Everyone’s design project 1 implementation should have a “Gesture” hierarchy (wether you called it Gesture or not, doesn’t matter) and a “Scoring” hierarchy. Many of you also have a Player or “hand” object. For homework 3, you must implement the Observer pattern so that your Player object notifies the Scoring object when it has chosen a gesture.

In other words, you will add GestureSubject and GestureObserver interfaces to your design, and modify the appropriate classes in your design to implement them.

If you do not have a Player (or similar) object in your design already, you should add that as well. The Player object for this homework does not need to be as described in the original DP1 Extra Credit section; it simply needs to be a class with a “getGesture()” method, that causes that player to choose a gesture (either randomly for computer-generated choices, or via console interaction for human-generated choices).

Provide one or more test cases where several player objects are created. “getGesture” should be called on each player, which in turn would notify the Scoring object (the observer, properly registered of course) of its choice. Your test case should assert that the scoring object can decide the correct winner after having been notified of the player choices.

Due: Friday Nov 2. Office hours by e-mail or appointment only.

UPDATE: To submit, you must create a branch of your design project 1, and implement the changes in that branch. Instructions to follow shortly!!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>