| Project 9 | |||||||||||||||||||||||
Due date: 3/17 @ 3pm Objective: to gain experience with a passive model-view separation and to deepen your understanding of the observer pattern Note:Thus far, the assignments concerned the model of the game only. If you already made an attempt to visualize the game, you probably tried to "test via looking." This is a bad idea, which is why I strictly design in a "model-first" manner. This is also what we teach now in CSU211. -Even if you have tried to implement a visualization, you will -- still have to reorganize your code to fit the observer protocol. See below. The Observer Interface: The model-view architecture assumes that you have strictly separated your system into components that implement the actual data manipulation and those that visualize (and often allow interaction with) the model. A visualization component is naturally an observer, just like the player. This suggests the refactoring of the interface hierarchy:
Now the player consists of two pieces: a player proper and an observer
that watches other players as they play.
Task 1: Implement this reorganization with a separation of player proper and observer. [POINTS: 5] Additional Information: Implementing the visualization observer requires a modification of the server:
That is, the administrator must now accept an additional kind of observer
and it must allow this observer access to the graph (in a controlled
manner via drawable-graph<%> ). To make the tiles
drawable, you will need to extend their interface, too (or add a drawable
interface):
The first three are definitely needed. The last one is useful in a
graphical context; if you choose others (say html, text), you will need
alternative methods.
Task 2: Implement an observer that visualizes the game. You may choose your favorite visualization context. I have used a GUI context and display the state of the game as follows: On the left, you see a scrolling text field that displays the actions; on the right you see a visual presentation of the graph. - No matter what visualization medium you choose, use the above interfaces to implement it. [POINTS: 12] Product: Mail a tar bundle with a a single subdirectory labeled
|
last updated on Tue Jun 9 22:03:19 EDT 2009 | generated with PLT Scheme |